aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/array-bounds.cpp
diff options
context:
space:
mode:
authorMatt Beaumont-Gay <matthewbg@google.com>2011-11-29 19:27:11 +0000
committerMatt Beaumont-Gay <matthewbg@google.com>2011-11-29 19:27:11 +0000
commitcfbc5b5660f49fae63acc1f5ef05df87070a2a3c (patch)
tree313a307634e02f8e582077baf00f7c8f497ea50c /test/SemaCXX/array-bounds.cpp
parent2cbe84dd36664b54bf056e4c69fe8d0fecd7346c (diff)
Merge branch 'yo-dawg-i-herd-u-like-arrays'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145421 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/array-bounds.cpp')
-rw-r--r--test/SemaCXX/array-bounds.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/SemaCXX/array-bounds.cpp b/test/SemaCXX/array-bounds.cpp
index 51a1937604..48788f67d7 100644
--- a/test/SemaCXX/array-bounds.cpp
+++ b/test/SemaCXX/array-bounds.cpp
@@ -4,10 +4,14 @@ int foo() {
int x[2]; // expected-note 4 {{array 'x' declared here}}
int y[2]; // expected-note 2 {{array 'y' declared here}}
int z[1]; // expected-note {{array 'z' declared here}}
+ int w[1][1]; // expected-note {{array 'w' declared here}}
+ int v[1][1][1]; // expected-note {{array 'v' declared here}}
int *p = &y[2]; // no-warning
(void) sizeof(x[2]); // no-warning
y[2] = 2; // expected-warning {{array index 2 is past the end of the array (which contains 2 elements)}}
z[1] = 'x'; // expected-warning {{array index 1 is past the end of the array (which contains 1 element)}}
+ w[0][2] = 0; // expected-warning {{array index 2 is past the end of the array (which contains 1 element)}}
+ v[0][0][2] = 0; // expected-warning {{array index 2 is past the end of the array (which contains 1 element)}}
return x[2] + // expected-warning {{array index 2 is past the end of the array (which contains 2 elements)}}
y[-1] + // expected-warning {{array index -1 is before the beginning of the array}}
x[sizeof(x)] + // expected-warning {{array index 8 is past the end of the array (which contains 2 elements)}}