<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - libc++ problem with std::enable_shared_from_this"
href="https://llvm.org/bugs/show_bug.cgi?id=27115">27115</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>libc++ problem with std::enable_shared_from_this
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>3.8
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>cball@lgsinnovations.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=16122" name="attach_16122" title="Main program. Build with clang++ -std=c++11 -stdlib=libc++ main.cpp">attachment 16122</a> <a href="attachment.cgi?id=16122&action=edit" title="Main program. Build with clang++ -std=c++11 -stdlib=libc++ main.cpp">[details]</a></span>
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>