
On Jan 21, 2013, at 12:28 PM, Ioannis Papadopoulos <ipapadop@cse.tamu.edu> wrote:
OK, another problem in Boost.Fusion:
#include <boost/tr1/tuple.hpp> #include <boost/tr1/functional.hpp>
int a, b;
std::tr1::tuple<int&, int&> get() { return std::tr1::tuple<int&, int&>(std::tr1::ref(a), std::tr1::ref(b)); }
int main() { std::tr1::tuple<int&, int&> t = get(); return 0; }
cannot compile with GCC 4.7.2 / C++11 when defining BOOST_FUSION_DONT_USE_PREPROCESSED_FILES:
$ g++ --std=c++11 -DBOOST_FUSION_DONT_USE_PREPROCESSED_FILES test.cc -I /usr/local/boost/boost_1_53_beta/include/ [ error message snipped ]
I can reproduce this here as well (with clang): $ clang++ -std=c++11 -stdlib=libc++ -DBOOST_FUSION_DONT_USE_PREPROCESSED_FILES -I /Sources/boost/beta1 junk.cpp In file included from junk.cpp:1: In file included from /Sources/boost/trunk/boost/tr1/tuple.hpp:58: In file included from /Sources/boost/trunk/boost/fusion/include/tuple.hpp:10: In file included from /Sources/boost/trunk/boost/fusion/tuple.hpp:10: In file included from /Sources/boost/trunk/boost/fusion/tuple/tuple.hpp:11: In file included from /Sources/boost/trunk/boost/fusion/container/vector/vector.hpp:10: In file included from /Sources/boost/trunk/boost/fusion/container/vector/vector_fwd.hpp:14: In file included from /Sources/boost/trunk/boost/fusion/container/vector/vector10.hpp:87: In file included from /Sources/boost/trunk/boost/preprocessor/iteration/detail/iter/forward1.hpp:57: /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_n.hpp:57:22: error: constructor cannot be redeclared BOOST_PP_CAT(vector_data, N)( ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:22:47: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ <scratch space>:170:1: note: expanded from macro 'vector_data' vector_data2 ^ /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_n.hpp:104:22: note: in instantiation of template class 'boost::fusion::vector_data2<int &, int &>' requested here : BOOST_PP_CAT(vector_data, N)<BOOST_PP_ENUM_PARAMS(N, T)> ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:22:47: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ <scratch space>:43:1: note: expanded from macro 'vector_data' vector_data2 ^ /Sources/boost/trunk/boost/fusion/container/vector/vector.hpp:92:26: note: in instantiation of template class 'boost::fusion::vector2<int &, int &>' requested here typedef typename vector_n::types types; ^ /Sources/boost/trunk/boost/fusion/tuple/tuple.hpp:44:20: note: in instantiation of template class 'boost::fusion::vector<int &, int &, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>' requested here struct tuple : vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)> ^ junk.cpp:6:29: note: in instantiation of template class 'boost::fusion::tuple<int &, int &, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>' requested here std::tr1::tuple<int&, int&> get() ^ /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_n.hpp:53:22: note: previous declaration is here BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _)) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:22:47: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ <scratch space>:126:1: note: expanded from macro 'vector_data' vector_data2 ^ In file included from junk.cpp:1: In file included from /Sources/boost/trunk/boost/tr1/tuple.hpp:58: In file included from /Sources/boost/trunk/boost/fusion/include/tuple.hpp:10: In file included from /Sources/boost/trunk/boost/fusion/tuple.hpp:10: In file included from /Sources/boost/trunk/boost/fusion/tuple/tuple.hpp:11: In file included from /Sources/boost/trunk/boost/fusion/container/vector/vector.hpp:10: In file included from /Sources/boost/trunk/boost/fusion/container/vector/vector_fwd.hpp:14: In file included from /Sources/boost/trunk/boost/fusion/container/vector/vector10.hpp:87: In file included from /Sources/boost/trunk/boost/preprocessor/iteration/detail/iter/forward1.hpp:57: /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_n.hpp:130:22: error: constructor cannot be redeclared BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _)) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:22:47: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ <scratch space>:188:1: note: expanded from macro 'vector' vector2 ^ /Sources/boost/trunk/boost/fusion/container/vector/vector.hpp:92:26: note: in instantiation of template class 'boost::fusion::vector2<int &, int &>' requested here typedef typename vector_n::types types; ^ /Sources/boost/trunk/boost/fusion/tuple/tuple.hpp:44:20: note: in instantiation of template class 'boost::fusion::vector<int &, int &, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>' requested here struct tuple : vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)> ^ junk.cpp:6:29: note: in instantiation of template class 'boost::fusion::tuple<int &, int &, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>' requested here std::tr1::tuple<int&, int&> get() ^ /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_n.hpp:121:22: note: previous declaration is here BOOST_PP_CAT(vector, N)( ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:22:47: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ <scratch space>:147:1: note: expanded from macro 'vector' vector2 ^ In file included from junk.cpp:1: In file included from /Sources/boost/trunk/boost/tr1/tuple.hpp:58: In file included from /Sources/boost/trunk/boost/fusion/include/tuple.hpp:10: In file included from /Sources/boost/trunk/boost/fusion/tuple.hpp:10: In file included from /Sources/boost/trunk/boost/fusion/tuple/tuple.hpp:11: In file included from /Sources/boost/trunk/boost/fusion/container/vector/vector.hpp:125: In file included from /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_forward_ctor.hpp:20: In file included from /Sources/boost/trunk/boost/preprocessor/iteration/detail/iter/forward1.hpp:52: /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_forward_ctor.hpp:44:5: error: constructor cannot be redeclared vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _)) ^ /Sources/boost/trunk/boost/fusion/tuple/tuple.hpp:44:20: note: in instantiation of template class 'boost::fusion::vector<int &, int &, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>' requested here struct tuple : vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)> ^ junk.cpp:6:29: note: in instantiation of template class 'boost::fusion::tuple<int &, int &, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>' requested here std::tr1::tuple<int&, int&> get() ^ /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_forward_ctor.hpp:36:5: note: previous declaration is here vector(BOOST_PP_ENUM_BINARY_PARAMS( ^ In file included from junk.cpp:1: In file included from /Sources/boost/trunk/boost/tr1/tuple.hpp:58: In file included from /Sources/boost/trunk/boost/fusion/include/tuple.hpp:10: In file included from /Sources/boost/trunk/boost/fusion/tuple.hpp:10: In file included from /Sources/boost/trunk/boost/fusion/tuple/tuple.hpp:11: In file included from /Sources/boost/trunk/boost/fusion/container/vector/vector.hpp:125: In file included from /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_forward_ctor.hpp:20: In file included from /Sources/boost/trunk/boost/preprocessor/iteration/detail/iter/forward1.hpp:57: /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_forward_ctor.hpp:44:5: error: constructor cannot be redeclared vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _)) ^ /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_forward_ctor.hpp:36:5: note: previous declaration is here vector(BOOST_PP_ENUM_BINARY_PARAMS( ^ /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_forward_ctor.hpp:45:11: error: no matching constructor for initialization of 'vector_n' (aka 'vector2<int &, int &>') : vec(BOOST_PP_ENUM(N, FUSION_FORWARD_CTOR_MOVE, _)) {} ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Sources/boost/trunk/boost/fusion/tuple/detail/tuple_expand.hpp:35:11: note: in instantiation of member function 'boost::fusion::vector<int &, int &, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>::vector' requested here : base_type(BOOST_PP_ENUM_PARAMS(N, _)) {} ^ junk.cpp:8:9: note: in instantiation of member function 'boost::fusion::tuple<int &, int &, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>::tuple' requested here return std::tr1::tuple<int&, int&>(std::tr1::ref(a), std::tr1::ref(b)); ^ /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_n.hpp:130:22: note: candidate constructor not viable: no known conversion from 'typename remove_reference<int &>::type' (aka 'int') to 'int &&' for 1st argument; BOOST_PP_CAT(vector, N)(BOOST_PP_ENUM_BINARY_PARAMS(N, T, && _)) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:22:47: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ <scratch space>:188:1: note: expanded from macro 'vector' vector2 ^ /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_n.hpp:140:22: note: candidate constructor template not viable: requires 1 argument, but 2 were provided BOOST_PP_CAT(vector, N)( ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:22:47: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ <scratch space>:33:1: note: expanded from macro 'vector' vector2 ^ /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_n.hpp:145:22: note: candidate constructor template not viable: requires 1 argument, but 2 were provided BOOST_PP_CAT(vector, N)( ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:22:47: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ <scratch space>:73:1: note: expanded from macro 'vector' vector2 ^ /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_n.hpp:154:22: note: candidate constructor template not viable: requires 1 argument, but 2 were provided BOOST_PP_CAT(vector, N)( ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:22:47: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ <scratch space>:76:1: note: expanded from macro 'vector' vector2 ^ /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_n.hpp:116:22: note: candidate constructor not viable: requires 0 arguments, but 2 were provided BOOST_PP_CAT(vector, N)() {} ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:22:47: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ <scratch space>:144:1: note: expanded from macro 'vector' vector2 ^ /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_n.hpp:135:22: note: candidate constructor not viable: requires 1 argument, but 2 were provided BOOST_PP_CAT(vector, N)(BOOST_PP_CAT(vector, N)&& rhs) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:22:47: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ <scratch space>:11:1: note: expanded from macro 'vector' vector2 ^ /Sources/boost/trunk/boost/fusion/container/vector/detail/vector_n.hpp:103:25: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided struct BOOST_PP_CAT(vector, N) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:22:47: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ /Sources/boost/trunk/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ <scratch space>:41:1: note: expanded from macro 'vector' vector2 ^ 5 errors generated. -- Marshall Marshall Clow Idio Software <mailto:mclow.lists@gmail.com> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki