aboutsummaryrefslogtreecommitdiff
path: root/clang/test/AST/ByteCode
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/AST/ByteCode')
-rw-r--r--clang/test/AST/ByteCode/arrays.cpp11
-rw-r--r--clang/test/AST/ByteCode/placement-new.cpp29
2 files changed, 40 insertions, 0 deletions
diff --git a/clang/test/AST/ByteCode/arrays.cpp b/clang/test/AST/ByteCode/arrays.cpp
index 22a4b41..eaf9559 100644
--- a/clang/test/AST/ByteCode/arrays.cpp
+++ b/clang/test/AST/ByteCode/arrays.cpp
@@ -820,3 +820,14 @@ namespace FAM {
return 1;
}
}
+
+namespace MultiDimConstructExpr {
+ struct a {
+ a *p = this;
+ };
+ struct b {
+ a m[3][3];
+ };
+ constexpr b d;
+ static_assert(d.m[2][1].p == &d.m[2][1]);
+}
diff --git a/clang/test/AST/ByteCode/placement-new.cpp b/clang/test/AST/ByteCode/placement-new.cpp
index b587cd6..1c015da 100644
--- a/clang/test/AST/ByteCode/placement-new.cpp
+++ b/clang/test/AST/ByteCode/placement-new.cpp
@@ -494,3 +494,32 @@ constexpr int modify_const_variable() {
}
static_assert(modify_const_variable()); // both-error {{not an integral constant expression}} \
// both-note {{in call to}}
+
+constexpr int nullDest() {
+ new (nullptr) int{12}; // both-note {{construction of dereferenced null pointer}}
+ return 0;
+}
+static_assert(nullDest() == 0); // both-error {{not an integral constant expression}} \
+ // both-note {{in call to}}
+
+constexpr int nullArrayDest() {
+ new (nullptr) int{12}; // both-note {{construction of dereferenced null pointer}}
+ return 0;
+}
+static_assert(nullArrayDest() == 0); // both-error {{not an integral constant expression}} \
+ // both-note {{in call to}}
+
+constexpr int intDest() {
+ new ((void*)2) int{3}; // both-note {{cast that performs the conversions of a reinterpret_cast}}
+ return 0;
+}
+static_assert(intDest() == 0); // both-error {{not an integral constant expression}} \
+ // both-note {{in call to}}
+
+constexpr int intDestArray() {
+ new ((void*)2) int[4]; // both-note {{cast that performs the conversions of a reinterpret_cast}}
+ return 0;
+}
+static_assert(intDestArray() == 0); // both-error {{not an integral constant expression}} \
+ // both-note {{in call to}}
+