mirror of
https://github.com/intel/llvm.git
synced 2026-02-07 07:39:11 +08:00
Fix PR#18843. Thanks to Howard for the fix
llvm-svn: 240136
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user