https://bugs.llvm.org/show_bug.cgi?id=35842
Bug ID: 35842
Summary: Clang 6 fails to compile boost variant code in unnamed
namespace
Product: clang
Version: 6.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: da...@davidhallas.dk
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
Created attachment 19640
--> https://bugs.llvm.org/attachment.cgi?id=19640&action=edit
Simplified test case
Clang 6 fails to compile the simple example attached to the bug. It fails with
the following error:
In file included from test.cpp:1:
In file included from /usr/include/boost/variant/variant.hpp:30:
In file included from /usr/include/boost/variant/detail/initializer.hpp:21:
In file included from /usr/include/boost/detail/reference_content.hpp:19:
In file included from /usr/include/boost/type_traits/has_nothrow_copy.hpp:19:
In file included from
/usr/include/boost/type_traits/is_copy_constructible.hpp:17:
In file included from /usr/include/boost/type_traits/is_constructible.hpp:17:
In file included from /usr/include/boost/type_traits/is_destructible.hpp:19:
/usr/include/boost/type_traits/declval.hpp:40:44: error: function
'boost::declval<(anonymous namespace)::Pod &>' is used but not defined in this
translation unit, and cannot be defined in any other translation unit because
its
type does not have linkage
typename add_rvalue_reference<T>::type declval() BOOST_NOEXCEPT; // as
unevaluated operand
^
/usr/include/boost/variant/detail/apply_visitor_unary.hpp:112:30: note: used
here
return vis()( boost::declval< value_t& >() );
^
1 error generated.
If I move the Pod type out of the unnamed namespace it compiles fine. Also if
the visitor type is, say an int, it also compiles fine.
The same code compiles fine with clang-5 and gcc-6.
I have tested with boost-1.63.0 and boost-1.66.0 but with no difference.
The code is compiled with
clang++ -c test.cpp
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs