From 6ee30009ae0bfb827c1a42159531262088c06055 Mon Sep 17 00:00:00 2001 From: Skye Wanderman-Milne Date: Mon, 25 Jun 2018 10:52:47 -0700 Subject: Fix MacOS build. MacOS builds were failing with errors like the following: In file included from tensorflow/core/graph/graph_constructor.cc:16: In file included from ./tensorflow/core/graph/graph_constructor.h:19: In file included from bazel-out/darwin-opt/genfiles/tensorflow/core/framework/graph.pb.h:7: In file included from /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:439: In file included from /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:627: /Applications/Xcode_8.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:280:38: error: no type named 'type' in 'std::__1::enable_if'; 'enable_if' cannot be used to disable this declaration ,typename enable_if::value && ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./tensorflow/core/graph/tensor_id.h:66:15: note: in instantiation of member function 'std::__1::pair, int>::pair' requested here using Base::pair; ^ tensorflow/core/graph/graph_constructor.cc:411:28: note: while substituting deduced template arguments into function template 'SafeTensorId' [with _U1 = tensorflow::StringPiece, _U2 = int] TensorId src = mapping.first; ^ I'm still not exactly sure what the problem is and why it doesn't affect all compilers, but for some reason the compiler is trying to construct a SafeTensorId from a StringPiece. My guess is there's a std::pair constructor that takes another pair, and an enable_if isn't working correctly to prevent incompatible types from being ignored. PiperOrigin-RevId: 201980490 --- tensorflow/core/graph/tensor_id.cc | 3 +++ tensorflow/core/graph/tensor_id.h | 1 + 2 files changed, 4 insertions(+) (limited to 'tensorflow') diff --git a/tensorflow/core/graph/tensor_id.cc b/tensorflow/core/graph/tensor_id.cc index 80c76df255..b5c2c2aac8 100644 --- a/tensorflow/core/graph/tensor_id.cc +++ b/tensorflow/core/graph/tensor_id.cc @@ -24,6 +24,9 @@ namespace tensorflow { TensorId::TensorId(const SafeTensorId& id) : TensorId(id.first, id.second) {} +SafeTensorId::SafeTensorId(StringPiece str, int idx) + : SafeTensorId(str.ToString(), idx) {} + SafeTensorId::SafeTensorId(const TensorId& id) : SafeTensorId(id.first.ToString(), id.second) {} diff --git a/tensorflow/core/graph/tensor_id.h b/tensorflow/core/graph/tensor_id.h index bf13fc78a6..b0978b4120 100644 --- a/tensorflow/core/graph/tensor_id.h +++ b/tensorflow/core/graph/tensor_id.h @@ -68,6 +68,7 @@ struct SafeTensorId : public std::pair { // NOTE(skyewm): this is required on some platforms. I'm not sure why the // using statement above isn't always sufficient. SafeTensorId() : Base() {} + SafeTensorId(StringPiece str, int idx); SafeTensorId(const TensorId& id); string ToString() const { -- cgit v1.2.3