[libcxx] r242495 - Merging r242377:
Hans Wennborg
hans at hanshq.net
Thu Jul 16 18:00:15 PDT 2015
Author: hans
Date: Thu Jul 16 20:00:15 2015
New Revision: 242495
URL: http://llvm.org/viewvc/llvm-project?rev=242495&view=rev
Log:
Merging r242377:
------------------------------------------------------------------------
r242377 | marshall | 2015-07-15 20:05:06 -0700 (Wed, 15 Jul 2015) | 1 line
Make sure that __libcpp_compressed_pair_imp default-constructs its' members, rather than value-initializing them. Fixes PR#24137
------------------------------------------------------------------------
Modified:
libcxx/branches/release_37/ (props changed)
libcxx/branches/release_37/include/memory
libcxx/branches/release_37/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
Propchange: libcxx/branches/release_37/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jul 16 20:00:15 2015
@@ -1,2 +1,2 @@
/libcxx/branches/apple:136569-137939
-/libcxx/trunk:242421
+/libcxx/trunk:242377,242421
Modified: libcxx/branches/release_37/include/memory
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_37/include/memory?rev=242495&r1=242494&r2=242495&view=diff
==============================================================================
--- libcxx/branches/release_37/include/memory (original)
+++ libcxx/branches/release_37/include/memory Thu Jul 16 20:00:15 2015
@@ -2035,11 +2035,11 @@ public:
typedef const typename remove_reference<_T1>::type& _T1_const_reference;
typedef const typename remove_reference<_T2>::type& _T2_const_reference;
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
+ _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_(), __second_() {}
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
- : __first_(_VSTD::forward<_T1_param>(__t1)) {}
+ : __first_(_VSTD::forward<_T1_param>(__t1)), __second_() {}
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
- : __second_(_VSTD::forward<_T2_param>(__t2)) {}
+ : __first_(), __second_(_VSTD::forward<_T2_param>(__t2)) {}
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
: __first_(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {}
@@ -2128,9 +2128,9 @@ public:
typedef const _T1& _T1_const_reference;
typedef const typename remove_reference<_T2>::type& _T2_const_reference;
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
+ _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __second_() {}
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
- : _T1(_VSTD::forward<_T1_param>(__t1)) {}
+ : _T1(_VSTD::forward<_T1_param>(__t1)), __second_() {}
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
: __second_(_VSTD::forward<_T2_param>(__t2)) {}
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
@@ -2218,11 +2218,11 @@ public:
typedef const typename remove_reference<_T1>::type& _T1_const_reference;
typedef const _T2& _T2_const_reference;
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
+ _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_() {}
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
: __first_(_VSTD::forward<_T1_param>(__t1)) {}
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
- : _T2(_VSTD::forward<_T2_param>(__t2)) {}
+ : _T2(_VSTD::forward<_T2_param>(__t2)), __first_() {}
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
_NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
is_nothrow_move_constructible<_T2>::value)
Modified: libcxx/branches/release_37/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_37/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp?rev=242495&r1=242494&r2=242495&view=diff
==============================================================================
--- libcxx/branches/release_37/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp (original)
+++ libcxx/branches/release_37/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp Thu Jul 16 20:00:15 2015
@@ -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;
{
More information about the cfe-commits
mailing list