Make sure that __libcpp_compressed_pair_imp default-constructs its' members, rather than value-initializing them. Fixes PR#24137
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@242377 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -37,6 +37,14 @@ private:
|
||||
|
||||
int A::count = 0;
|
||||
|
||||
|
||||
struct Foo
|
||||
{
|
||||
Foo() = default;
|
||||
virtual ~Foo() = default;
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
int nc = globalMemCounter.outstanding_new;
|
||||
@@ -49,6 +57,14 @@ int main()
|
||||
assert(p->get_int() == 67);
|
||||
assert(p->get_char() == 'e');
|
||||
}
|
||||
|
||||
{ // https://llvm.org/bugs/show_bug.cgi?id=24137
|
||||
std::shared_ptr<Foo> p1 = std::make_shared<Foo>();
|
||||
assert(p1.get());
|
||||
std::shared_ptr<const Foo> p2 = std::make_shared<const Foo>();
|
||||
assert(p2.get());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
nc = globalMemCounter.outstanding_new;
|
||||
{
|
||||
|
Reference in New Issue
Block a user