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/builtin-functions.cpp5
-rw-r--r--clang/test/AST/ByteCode/c.c6
-rw-r--r--clang/test/AST/ByteCode/records.cpp21
-rw-r--r--clang/test/AST/ByteCode/unions.cpp9
4 files changed, 41 insertions, 0 deletions
diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp
index d8572ba..e9093b2 100644
--- a/clang/test/AST/ByteCode/builtin-functions.cpp
+++ b/clang/test/AST/ByteCode/builtin-functions.cpp
@@ -1855,3 +1855,8 @@ namespace InitParam {
}
#endif
+
+namespace SAddOverflowInt {
+ int a;
+ void foo(void) { a *= __builtin_sadd_overflow(1, 2, 0); }
+}
diff --git a/clang/test/AST/ByteCode/c.c b/clang/test/AST/ByteCode/c.c
index cfdc9d0..3360d4f 100644
--- a/clang/test/AST/ByteCode/c.c
+++ b/clang/test/AST/ByteCode/c.c
@@ -381,3 +381,9 @@ static char foo_(a) // all-warning {{definition without a prototype}}
static void bar_(void) {
foo_(foo_(1));
}
+
+void foo2(void*);
+void bar2(void) {
+ int a[2][3][4][5]; // all-note {{array 'a' declared here}}
+ foo2(&a[0][4]); // all-warning {{array index 4 is past the end of the array}}
+}
diff --git a/clang/test/AST/ByteCode/records.cpp b/clang/test/AST/ByteCode/records.cpp
index 00218ba..83f32c9 100644
--- a/clang/test/AST/ByteCode/records.cpp
+++ b/clang/test/AST/ByteCode/records.cpp
@@ -1861,3 +1861,24 @@ namespace PrimitiveInitializedByInitList {
} c{ 17 };
static_assert(c.b == 17, "");
}
+
+namespace MethodWillHaveBody {
+ class A {
+ public:
+ static constexpr int get_value2() { return 1 + get_value(); }
+ static constexpr int get_value() { return 1; }
+ };
+ static_assert(A::get_value2() == 2, "");
+
+ template<typename T> constexpr T f(T);
+ template<typename T> constexpr T g(T t) {
+ typedef int arr[f(T())]; // both-warning {{variable length array}} \
+ // both-note {{undefined function 'f<int>'}}
+ return t;
+ }
+ template<typename T> constexpr T f(T t) { // both-note {{declared here}}
+ typedef int arr[g(T())]; // both-note {{instantiation of}}
+ return t;
+ }
+ int n = f(0); // both-note {{instantiation of}}
+}
diff --git a/clang/test/AST/ByteCode/unions.cpp b/clang/test/AST/ByteCode/unions.cpp
index 6bccbda..4140704 100644
--- a/clang/test/AST/ByteCode/unions.cpp
+++ b/clang/test/AST/ByteCode/unions.cpp
@@ -977,4 +977,13 @@ namespace UnionMemberOnePastEnd {
}
static_assert(!b());
}
+
+namespace ActicvateInvalidPtr {
+ constexpr void bar() { // both-error {{never produces a constant expression}}
+ union {
+ int a[1];
+ } foo;
+ foo.a[1] = 0; // both-note {{assignment to dereferenced one-past-the-end pointer}}
+ }
+}
#endif