[libcxx] r240136 - Fix PR#18843. Thanks to Howard for the fix
Marshall Clow
mclow.lists at gmail.com
Fri Jun 19 08:54:13 PDT 2015
Author: marshall
Date: Fri Jun 19 10:54:13 2015
New Revision: 240136
URL: http://llvm.org/viewvc/llvm-project?rev=240136&view=rev
Log:
Fix PR#18843. Thanks to Howard for the fix
Modified:
libcxx/trunk/include/memory
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
Modified: libcxx/trunk/include/memory
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=240136&r1=240135&r2=240136&view=diff
==============================================================================
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Fri Jun 19 10:54:13 2015
@@ -4073,7 +4073,10 @@ private:
__enable_weak_this(const enable_shared_from_this<_Yp>* __e) _NOEXCEPT
{
if (__e)
- __e->__weak_this_ = *this;
+ {
+ __e->__weak_this_.__ptr_ = const_cast<_Yp*>(static_cast<const _Yp*>(__e));
+ __e->__weak_this_.__cntrl_ = __cntrl_;
+ }
}
_LIBCPP_INLINE_VISIBILITY
Modified: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=240136&r1=240135&r2=240136&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp Fri Jun 19 10:54:13 2015
@@ -34,6 +34,10 @@ struct Z : Y {};
int main()
{
+ { // https://llvm.org/bugs/show_bug.cgi?id=18843
+ std::shared_ptr<T const> t1(new T);
+ std::shared_ptr<T const> t2(std::make_shared<T>());
+ }
{
std::shared_ptr<Y> p(new Z);
std::shared_ptr<T> q = p->shared_from_this();
More information about the cfe-commits
mailing list