summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx2a-constexpr-dynalloc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX/cxx2a-constexpr-dynalloc.cpp')
-rw-r--r--clang/test/SemaCXX/cxx2a-constexpr-dynalloc.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx2a-constexpr-dynalloc.cpp b/clang/test/SemaCXX/cxx2a-constexpr-dynalloc.cpp
index 23582f2e302..3647526ff0a 100644
--- a/clang/test/SemaCXX/cxx2a-constexpr-dynalloc.cpp
+++ b/clang/test/SemaCXX/cxx2a-constexpr-dynalloc.cpp
@@ -166,3 +166,13 @@ constexpr bool construct_after_lifetime() {
return true;
}
static_assert(construct_after_lifetime()); // expected-error {{}} expected-note {{in call}}
+
+constexpr bool construct_after_lifetime_2() {
+ struct A { struct B {} b; };
+ A a;
+ a.~A();
+ std::construct_at<A::B>(&a.b); // expected-note {{in call}}
+ // expected-note@#new {{construction of subobject of object outside its lifetime is not allowed in a constant expression}}
+ return true;
+}
+static_assert(construct_after_lifetime_2()); // expected-error {{}} expected-note {{in call}}
OpenPOWER on IntegriCloud