diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2017-12-05 04:09:49 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2017-12-05 04:09:49 +0000 |
commit | df68ebc39b3d83f310b90e70e241b1b9aaf0ea49 (patch) | |
tree | ab6af6201a50f375400dbd92f8c0f73d9f9b08b4 /test | |
parent | f7d0fecf346bb09a13674a78b6f333912ae67501 (diff) |
Land D28253 which fixes PR28929 (which we mistakenly marked as fixed before)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@319736 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
2 files changed, 58 insertions, 0 deletions
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.private.fail.cpp new file mode 100644 index 000000000..7f304054b --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// <memory> + +// shared_ptr + +// template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args); + +#include <memory> +#include <cassert> + +#include "test_macros.h" + +struct S { +private: + S () {}; // ctor is private +}; + +int main() +{ + std::shared_ptr<S> p = std::make_shared<S>(); +} diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp new file mode 100644 index 000000000..0eeeed4e8 --- /dev/null +++ b/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. +// +//===----------------------------------------------------------------------===// + +// <memory> + +// shared_ptr + +// template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args); + +#include <memory> +#include <cassert> + +#include "test_macros.h" + +struct S { +protected: + S () {}; // ctor is protected +}; + +int main() +{ + std::shared_ptr<S> p = std::make_shared<S>(); // expected-error-re@memory:* {{static_assert failed{{.*}} "Can't construct object in make_shared"}} +} |