Opened 10 years ago

Closed 10 years ago

#7566 closed Bugs (fixed)

invalid use of std::forward when compiling with std=c++0x

Reported by: viboes Owned by: Gennadiy Rozental
Milestone: To Be Determined Component: test
Version: Boost Development Trunk Severity: Showstopper
Keywords: Cc: viboes

Description

clang-darwin.compile.c++ ../../../bin.v2/libs/test/build/clang-darwin-3.0x/debug/link-static/threading-multi/exception_safety.o
In file included from ../../../libs/test/src/exception_safety.cpp:16:
In file included from ../../../boost/test/impl/exception_safety.ipp:30:
In file included from ../../../boost/test/test_tools.hpp:328:
In file included from ../../../boost/test/tools/impl.hpp:25:
../../../boost/test/tools/assertion.hpp:279:21: error: no member named 'forward' in namespace 'std'
    : m_value( std::forward<T>(val) )
               ~~~~~^
../../../boost/test/tools/assertion.hpp:279:29: error: 'T' does not refer to a value
    : m_value( std::forward<T>(val) )
                            ^
../../../boost/test/tools/assertion.hpp:270:19: note: declared here
template<typename T>

Change History (6)

comment:1 by Marshall Clow, 10 years ago

You need to include libc++ with clang when using c++11 library features.

See http://marshall.calepin.co/llvmclang-and-standard-libraries-on-mac-os-x.html for more (non-boost specific) information about this.

comment:2 by viboes, 10 years ago

When I compile with

using clang : 3.0xl : /Users/viboes/clang/llvmCore-3.0-rc1.install/bin/clang++ : <cxxflags>"-std=c++0x -stdlib=libc++" <linkflags>"-std=c++0x -stdlib=libc++" ;

I'm getting the following. Is there something wrong on my installation?

/Users/viboes/boost/trunk/libs/test/test

gt-s8600:test viboes$ bjam toolset=clang-3.0xl  -q
...patience...
...patience...
...found 1705 targets...
...updating 259 targets...
clang-darwin.compile.c++ ../../../bin.v2/libs/test/test/class_properties_test.test/clang-darwin-3.0xl/debug/class_properties_test.o
In file included from class_properties_test.cpp:17:
In file included from ../../../boost/test/unit_test.hpp:19:
In file included from ../../../boost/test/test_tools.hpp:20:
In file included from ../../../boost/test/unit_test_log.hpp:27:
In file included from ../../../boost/test/utils/wrap_stringstream.hpp:26:
In file included from /usr/include/c++/v1/sstream:174:
In file included from /usr/include/c++/v1/ostream:130:
In file included from /usr/include/c++/v1/ios:216:
In file included from /usr/include/c++/v1/__locale:18:
In file included from /usr/include/c++/v1/mutex:177:
/usr/include/c++/v1/functional:1115:47: error: function cannot return function type 'type-parameter-0-0 (type-parameter-0-1...)'
    template <class _Fp, bool = !is_same<_Fp, function>::value &&
                                              ^
/usr/include/c++/v1/functional:1142:35: note: in instantiation of default argument for '__callable<type-parameter-1-0>' required here
               typename enable_if<__callable<_Fp>::value>::type* = 0);
                                  ^~~~~~~~~~~~~~~
Assertion failed: (!T.isNull() && "Instantiation of injected-class-name cannot fail."), function FindInstantiatedDecl, file /Users/void/llvm/3.0-release/rc1/cfe.src/lib/Sema/SemaTemplateInstantiateDecl.cpp, line 3156.
0  clang             0x00000001060ac432 llvm::SmallVectorImpl<llvm_regmatch_t>::resize(unsigned int) + 2162
1  clang             0x00000001060ac959 llvm::SmallVectorImpl<llvm_regmatch_t>::resize(unsigned int) + 3481
2  libsystem_c.dylib 0x00007fff8f990cfa _sigtramp + 26
3  libsystem_c.dylib 0x00007fd482889be1 _sigtramp + 18446743888806776577
4  clang             0x00000001060ac686 llvm::SmallVectorImpl<llvm_regmatch_t>::resize(unsigned int) + 2758
5  clang             0x00000001060ac645 llvm::SmallVectorImpl<llvm_regmatch_t>::resize(unsigned int) + 2693
6  clang             0x00000001052c0d17 clang::TypeLocBuilder::pushFullUninitializedImpl(clang::QualType, unsigned long) + 3511
7  clang             0x00000001052ba204 clang::MemberPointerType::isMemberFunctionPointer() const + 98148
8  clang             0x00000001052a74cd clang::MemberPointerType::isMemberFunctionPointer() const + 21037
9  clang             0x00000001052a4fbe clang::MemberPointerType::isMemberFunctionPointer() const + 11550
10 clang             0x00000001052b90e4 clang::MemberPointerType::isMemberFunctionPointer() const + 93764
11 clang             0x00000001052bb047 clang::MemberPointerType::isMemberFunctionPointer() const + 101799
12 clang             0x00000001052b6977 clang::MemberPointerType::isMemberFunctionPointer() const + 83671
13 clang             0x00000001052b1856 clang::MemberPointerType::isMemberFunctionPointer() const + 62902
14 clang             0x00000001052b5700 clang::MemberPointerType::isMemberFunctionPointer() const + 78944
15 clang             0x00000001052bc14b clang::MemberPointerType::isMemberFunctionPointer() const + 106155
16 clang             0x00000001052ae0b4 clang::MemberPointerType::isMemberFunctionPointer() const + 48660
17 clang             0x00000001052adab1 clang::MemberPointerType::isMemberFunctionPointer() const + 47121
18 clang             0x00000001052542c9 std::vector<std::pair<llvm::APSInt, clang::CaseStmt*>, std::allocator<std::pair<llvm::APSInt, clang::CaseStmt*> > >::_M_insert_aux(__gnu_cxx::__normal_iterator<std::pair<llvm::APSInt, clang::CaseStmt*>*, std::vector<std::pair<llvm::APSInt, clang::CaseStmt*>, std::allocator<std::pair<llvm::APSInt, clang::CaseStmt*> > > >, std::pair<llvm::APSInt, clang::CaseStmt*> const&) + 46745
19 clang             0x00000001052514ee std::vector<std::pair<llvm::APSInt, clang::CaseStmt*>, std::allocator<std::pair<llvm::APSInt, clang::CaseStmt*> > >::_M_insert_aux(__gnu_cxx::__normal_iterator<std::pair<llvm::APSInt, clang::CaseStmt*>*, std::vector<std::pair<llvm::APSInt, clang::CaseStmt*>, std::allocator<std::pair<llvm::APSInt, clang::CaseStmt*> > > >, std::pair<llvm::APSInt, clang::CaseStmt*> const&) + 35006
20 clang             0x00000001052508ac std::vector<std::pair<llvm::APSInt, clang::CaseStmt*>, std::allocator<std::pair<llvm::APSInt, clang::CaseStmt*> > >::_M_insert_aux(__gnu_cxx::__normal_iterator<std::pair<llvm::APSInt, clang::CaseStmt*>*, std::vector<std::pair<llvm::APSInt, clang::CaseStmt*>, std::allocator<std::pair<llvm::APSInt, clang::CaseStmt*> > > >, std::pair<llvm::APSInt, clang::CaseStmt*> const&) + 31868
21 clang             0x000000010507b9e1 std::vector<std::pair<unsigned int, clang::SourceLocation>, std::allocator<std::pair<unsigned int, clang::SourceLocation> > >::_M_insert_aux(__gnu_cxx::__normal_iterator<std::pair<unsigned int, clang::SourceLocation>*, std::vector<std::pair<unsigned int, clang::SourceLocation>, std::allocator<std::pair<unsigned int, clang::SourceLocation> > > >, std::pair<unsigned int, clang::SourceLocation> const&) + 11649
22 clang             0x0000000105026c1a std::deque<clang::Parser::ParsingClass*, std::allocator<clang::Parser::ParsingClass*> >::_M_reallocate_map(unsigned long, bool) + 37098
23 clang             0x0000000105052928 llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument, false>::grow(unsigned long) + 37048
24 clang             0x0000000105049ca9 llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument, false>::grow(unsigned long) + 1081
25 clang             0x000000010504ae16 llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument, false>::grow(unsigned long) + 5542
26 clang             0x0000000105048c58 clang::PragmaFPContractHandler::~PragmaFPContractHandler() + 44232
27 clang             0x00000001050484a9 clang::PragmaFPContractHandler::~PragmaFPContractHandler() + 42265
28 clang             0x0000000105048005 clang::PragmaFPContractHandler::~PragmaFPContractHandler() + 41077
29 clang             0x000000010504863f clang::PragmaFPContractHandler::~PragmaFPContractHandler() + 42671
30 clang             0x0000000105027205 std::deque<clang::Parser::ParsingClass*, std::allocator<clang::Parser::ParsingClass*> >::_M_reallocate_map(unsigned long, bool) + 38613
31 clang             0x0000000105052557 llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument, false>::grow(unsigned long) + 36071
32 clang             0x0000000105007bbc clang::Parser::LateParsedMemberInitializer::~LateParsedMemberInitializer() + 25836
33 clang             0x0000000105011627 clang::Parser::LateParsedMemberInitializer::~LateParsedMemberInitializer() + 65367
34 clang             0x000000010500ff35 clang::Parser::LateParsedMemberInitializer::~LateParsedMemberInitializer() + 59493
35 clang             0x000000010500f6f4 clang::Parser::LateParsedMemberInitializer::~LateParsedMemberInitializer() + 57380
36 clang             0x000000010500e7a0 clang::Parser::LateParsedMemberInitializer::~LateParsedMemberInitializer() + 53456
37 clang             0x000000010501a45d clang::Parser::LateParsedAttribute::~LateParsedAttribute() + 31197
38 clang             0x0000000105045fb6 clang::PragmaFPContractHandler::~PragmaFPContractHandler() + 32806
39 clang             0x0000000105045d7e clang::PragmaFPContractHandler::~PragmaFPContractHandler() + 32238
40 clang             0x000000010504598b clang::PragmaFPContractHandler::~PragmaFPContractHandler() + 31227
41 clang             0x0000000105019e98 clang::Parser::LateParsedAttribute::~LateParsedAttribute() + 29720
42 clang             0x0000000105018794 clang::Parser::LateParsedAttribute::~LateParsedAttribute() + 23828
43 clang             0x00000001050174bf clang::Parser::LateParsedAttribute::~LateParsedAttribute() + 19007
44 clang             0x0000000105007ad0 clang::Parser::LateParsedMemberInitializer::~LateParsedMemberInitializer() + 25600
45 clang             0x00000001050461fc clang::PragmaFPContractHandler::~PragmaFPContractHandler() + 33388
46 clang             0x0000000105045d7e clang::PragmaFPContractHandler::~PragmaFPContractHandler() + 32238
47 clang             0x000000010504598b clang::PragmaFPContractHandler::~PragmaFPContractHandler() + 31227
48 clang             0x0000000105005e66 clang::Parser::LateParsedMemberInitializer::~LateParsedMemberInitializer() + 18326
49 clang             0x000000010504f684 llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument, false>::grow(unsigned long) + 24084
50 clang             0x0000000105013db7 clang::Parser::LateParsedAttribute::~LateParsedAttribute() + 4919
51 clang             0x00000001050138bf clang::Parser::LateParsedAttribute::~LateParsedAttribute() + 3647
52 clang             0x0000000105005f68 clang::Parser::LateParsedMemberInitializer::~LateParsedMemberInitializer() + 18584
53 clang             0x000000010504f8da llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument, false>::grow(unsigned long) + 24682
54 clang             0x0000000105013db7 clang::Parser::LateParsedAttribute::~LateParsedAttribute() + 4919
55 clang             0x00000001050138bf clang::Parser::LateParsedAttribute::~LateParsedAttribute() + 3647
56 clang             0x0000000105005fe7 clang::Parser::LateParsedMemberInitializer::~LateParsedMemberInitializer() + 18711
57 clang             0x000000010504f684 llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument, false>::grow(unsigned long) + 24084
58 clang             0x000000010504ef17 llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument, false>::grow(unsigned long) + 22183
59 clang             0x0000000104ffebbd clang::CUDAGlobalAttr* clang::Decl::getAttr<clang::CUDAGlobalAttr>() const + 749
60 clang             0x0000000104fdb9e6 llvm::DenseMap<llvm::ValueMapCallbackVH<llvm::Value const*, llvm::TrackingVH<llvm::Value>, llvm::ValueMapConfig<llvm::Value const*>, llvm::DenseMapInfo<llvm::TrackingVH<llvm::Value> > >, llvm::TrackingVH<llvm::Value>, llvm::DenseMapInfo<llvm::ValueMapCallbackVH<llvm::Value const*, llvm::TrackingVH<llvm::Value>, llvm::ValueMapConfig<llvm::Value const*>, llvm::DenseMapInfo<llvm::TrackingVH<llvm::Value> > > >, llvm::DenseMapInfo<llvm::TrackingVH<llvm::Value> > >::init(unsigned int) + 3334
61 clang             0x0000000104df212b llvm::DenseMap<clang::IdentifierInfo const*, unsigned int, llvm::DenseMapInfo<clang::IdentifierInfo const*>, llvm::DenseMapInfo<unsigned int> >::grow(unsigned int) + 14123
62 clang             0x0000000104ddcf45 llvm::SmallVectorImpl<char const*>::insert(char const**, char const* const&) + 3013
63 clang             0x0000000104dd572a
64 clang             0x0000000104dd93df llvm::PrettyStackTraceProgram::~PrettyStackTraceProgram() + 831
65 clang             0x0000000104dd4234
66 clang             0x0000000000000039
Stack dump:
0.	Program arguments: /Users/viboes/clang/llvmCore-3.0-rc1.install/bin/clang -cc1 -triple x86_64-apple-macosx10.7.4 -emit-obj -mrelax-all -disable-free -main-file-name class_properties_test.cpp -pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 127.2 -g -coverage-file ../../../bin.v2/libs/test/test/class_properties_test.test/clang-darwin-3.0xl/debug/class_properties_test.o -resource-dir /Users/viboes/clang/llvmCore-3.0-rc1.install/bin/../lib/clang/3.0 -D BOOST_ALL_NO_LIB=1 -D BOOST_TEST_DYN_LINK=1 -D BOOST_TEST_NO_AUTO_LINK=1 -I ../../.. -stdlib=libc++ -fmodule-cache-path /var/folders/5q/281f2tpd7536zxygsw3t6ckm0000gn/T/clang-module-cache -O0 -Wall -pedantic -std=c++0x -fdeprecated-macro -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-dispatch-method=mixed -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o ../../../bin.v2/libs/test/test/class_properties_test.test/clang-darwin-3.0xl/debug/class_properties_test.o -x c++ class_properties_test.cpp 
1.	/usr/include/c++/v1/functional:1142:52: current parser token 'value'
2.	/usr/include/c++/v1/functional:473:1 <Spelling=/usr/include/c++/v1/__config:272:37>: parsing namespace 'std'
3.	/usr/include/c++/v1/functional:473:1 <Spelling=/usr/include/c++/v1/__config:272:59>: parsing namespace '__1'
4.	/usr/include/c++/v1/functional:1085:1: parsing struct/union/class body 'function'
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)
clang: note: diagnostic msg: Please submit a bug report to http://llvm.org/bugs/ and include command line arguments and all diagnostic information.
clang: note: diagnostic msg: Preprocessed source(s) are located at:
clang: note: diagnostic msg: /var/folders/5q/281f2tpd7536zxygsw3t6ckm0000gn/T/class_properties_test-zLuqj6.ii

    "/Users/viboes/clang/llvmCore-3.0-rc1.install/bin/clang++" -x c++ -std=c++0x -stdlib=libc++ -O0 -g -O0 -fno-inline -Wall -pedantic -g -DBOOST_ALL_NO_LIB=1 -DBOOST_TEST_DYN_LINK=1 -DBOOST_TEST_NO_AUTO_LINK=1 -I"../../.." -c -o "../../../bin.v2/libs/test/test/class_properties_test.test/clang-darwin-3.0xl/debug/class_properties_test.o" "class_properties_test.cpp"


comment:3 by viboes, 10 years ago

Cc: viboes added

comment:4 by Marshall Clow, 10 years ago

Well, your clang crashed. That's clearly non-optimal.

On the other hand, it appears that you've got a really old clang (3.0rc1). You might try a newer one.

comment:5 by Marshall Clow, 10 years ago

Just built this with both the current Apple released clang (part of Xcode 4.5.1) and this morning's TOT clang.

[ Using the same pattern as you in the user-config.jam ]

Both worked fine.

comment:6 by Gennadiy Rozental, 10 years ago

Resolution: fixed
Status: newclosed

I believe this is already fixed

Note: See TracTickets for help on using tickets.