http://llvm.org/bugs/show_bug.cgi?id=18843
Bug ID: 18843
Summary: Cannot create shared_ptr to const derived from
enable_shared_from_this
Product: libc++
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Using the latest svn checkout of libc++ with clang 3.3, the following code does
not compile, although it does compile under libstdc++:
--------------
#include <memory>
struct A : std::enable_shared_from_this<A>
{};
int main()
{
std::shared_ptr<A const>( new A() );
};
--------------
It seems that internally this tries to assign a shared_ptr<const A> to a
weak_ptr<A>, which obviously isn't valid, but it seems like very strange
behavior to be unable to create shared_ptr to constant classes derived from
enable_shared_from_this. In libstdc++ they seem to use const_cast to get
around this.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs