Index: include/memory =================================================================== --- include/memory +++ include/memory @@ -4435,6 +4435,7 @@ shared_ptr<_Tp> shared_ptr<_Tp>::make_shared(_Args&& ...__args) { + static_assert( is_constructible<_Tp, _Args...>::value, "Can't construct object in make_shared" ); typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; typedef allocator<_CntrlBlk> _A2; typedef __allocator_destructor<_A2> _D2; @@ -4453,6 +4454,7 @@ shared_ptr<_Tp> shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args) { + static_assert( is_constructible<_Tp, _Args...>::value, "Can't construct object in allocate_shared" ); typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2; typedef __allocator_destructor<_A2> _D2; @@ -4473,6 +4475,7 @@ shared_ptr<_Tp> shared_ptr<_Tp>::make_shared() { + static_assert((is_constructible<_Tp>::value), "Can't construct object in make_shared" ); typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; typedef allocator<_CntrlBlk> _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; @@ -4491,6 +4494,7 @@ shared_ptr<_Tp> shared_ptr<_Tp>::make_shared(_A0& __a0) { + static_assert((is_constructible<_Tp, _A0>::value), "Can't construct object in make_shared" ); typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; typedef allocator<_CntrlBlk> _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; @@ -4509,6 +4513,7 @@ shared_ptr<_Tp> shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1) { + static_assert((is_constructible<_Tp, _A0, _A1>::value), "Can't construct object in make_shared" ); typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; typedef allocator<_CntrlBlk> _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; @@ -4527,6 +4532,7 @@ shared_ptr<_Tp> shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1, _A2& __a2) { + static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" ); typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; typedef allocator<_CntrlBlk> _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; @@ -4545,6 +4551,7 @@ shared_ptr<_Tp> shared_ptr<_Tp>::allocate_shared(const _Alloc& __a) { + static_assert((is_constructible<_Tp>::value), "Can't construct object in allocate_shared" ); typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; @@ -4564,6 +4571,7 @@ shared_ptr<_Tp> shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0) { + static_assert((is_constructible<_Tp, _A0>::value), "Can't construct object in allocate_shared" ); typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; @@ -4583,6 +4591,7 @@ shared_ptr<_Tp> shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1) { + static_assert((is_constructible<_Tp, _A0, _A1>::value), "Can't construct object in allocate_shared" ); typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; @@ -4602,6 +4611,7 @@ shared_ptr<_Tp> shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2) { + static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" ); typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; Index: test/libcxx/test/config.py =================================================================== --- test/libcxx/test/config.py +++ test/libcxx/test/config.py @@ -412,6 +412,8 @@ self.lit_config.fatal("cxx_headers='%s' is not a directory." % cxx_headers) self.cxx.compile_flags += ['-I' + cxx_headers] + if self.libcxx_obj_root is None: + return cxxabi_headers = os.path.join(self.libcxx_obj_root, 'include', 'c++-build') if os.path.isdir(cxxabi_headers): self.cxx.compile_flags += ['-I' + cxxabi_headers] Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp =================================================================== --- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp +++ test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// shared_ptr + +// template shared_ptr make_shared(Args&&... args); + +#include +#include + +#include "test_macros.h" + +struct S { +private: + S () {}; // ctor is private +}; + +int main() +{ + std::shared_ptr p = std::make_shared(); +} Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp =================================================================== --- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp +++ test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// shared_ptr + +// template shared_ptr make_shared(Args&&... args); + +#include +#include + +#include "test_macros.h" + +struct S { +protected: + S () {}; // ctor is protected +}; + +int main() +{ + std::shared_ptr p = std::make_shared(); +}