https://llvm.org/bugs/show_bug.cgi?id=27115
Bug ID: 27115 Summary: libc++ problem with std::enable_shared_from_this Product: libc++ Version: 3.8 Hardware: All OS: All Status: NEW Severity: normal Priority: P Component: All Bugs Assignee: unassignedclangb...@nondot.org Reporter: cb...@lgsinnovations.com CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com Classification: Unclassified Created attachment 16122 --> https://llvm.org/bugs/attachment.cgi?id=16122&action=edit Main program. Build with clang++ -std=c++11 -stdlib=libc++ main.cpp We observe that the compiler fails when trying to build the simple example of code provided with Apple clang++ version 703.0.29 on Mac 10.11 and with clang++ 3.8.0 using libc++ on RedHat 7. g++ 4.9.2 on RedHat 7 does not exhibit the problem. The error reported is: clang++ -Werror -Wpedantic -Wall -std=c++11 main.cpp In file included from main.cpp:1: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iostream:38: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ios:216: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__locale:15: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:439: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:628: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4092:61: error: cannot cast 'const std::__1::enable_shared_from_this<Foo> *' to 'const Foo *' via virtual base 'std::__1::enable_shared_from_this<Foo>' __e->__weak_this_.__ptr_ = const_cast<_Yp*>(static_cast<const _Yp*>(__e)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4389:9: note: in instantiation of function template specialization 'std::__1::shared_ptr<Bar>::__enable_weak_this<Foo>' requested here __r.__enable_weak_this(__r.__ptr_); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4749:29: note: in instantiation of function template specialization 'std::__1::shared_ptr<Bar>::make_shared<int>' requested here return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...); ^ main.cpp:12:35: note: in instantiation of function template specialization 'std::__1::make_shared<Bar, int>' requested here std::shared_ptr<Bar> a = std::make_shared<Bar>(2); ^ 1 error generated. -- 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