summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/new-array-init.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-08-28 16:48:44 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-08-28 16:48:44 +0000
commit1c990380ce6984649f98d6bfea7543fa9e24f37b (patch)
treeb346fdbf7fec6f789a6c05dfc4babb32ac682a4f /test/CodeGenCXX/new-array-init.cpp
parentd2cac94bf572b95c17b57916dd540beb95c092d7 (diff)
Throw a std::bad_array_new_length exception when the expression (or constant-expression) passed to operator new[] results in overflow in conformance with [expr.new]p7. Fixes PR11644.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216675 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/new-array-init.cpp')
-rw-r--r--test/CodeGenCXX/new-array-init.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/CodeGenCXX/new-array-init.cpp b/test/CodeGenCXX/new-array-init.cpp
index 65123ea7fe..da11710bdd 100644
--- a/test/CodeGenCXX/new-array-init.cpp
+++ b/test/CodeGenCXX/new-array-init.cpp
@@ -14,7 +14,12 @@ void fn(int n) {
// CHECK-LABEL: define void @_Z15const_underflowv
void const_underflow() {
// CHECK-NOT: icmp ult i{{32|64}} %{{[^ ]+}}, 3
- // CHECK: call noalias i8* @_Zna{{.}}(i{{32|64}} -1)
+ // CHECK: br label %[[BAD:.*]]
+ // CHECK: [[BAD]]:
+ // CHECK-NEXT: call void @__cxa_bad_array_new_length()
+ // CHECK-NEXT: unreachable
+ // CHECK: {{.*}}:
+ // CHECK: ret void
new int[2] { 1, 2, 3 };
}