summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/array-bounds.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2012-01-24 04:29:18 +0000
committerDavid Blaikie <dblaikie@gmail.com>2012-01-24 04:29:18 +0000
commit7e625b67e5f9bbee38634a07c11590c05e97a66f (patch)
tree54956d9c36150368f22b5bcb4d0f92365633f1b4 /clang/test/SemaCXX/array-bounds.cpp
parent50cfa12752a2e746668b8e27e465a743fabfc408 (diff)
downloadbcm5719-llvm-7e625b67e5f9bbee38634a07c11590c05e97a66f.tar.gz
bcm5719-llvm-7e625b67e5f9bbee38634a07c11590c05e97a66f.zip
Simple hack to do unreachable code analysis on template patterns.
llvm-svn: 148774
Diffstat (limited to 'clang/test/SemaCXX/array-bounds.cpp')
-rw-r--r--clang/test/SemaCXX/array-bounds.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/test/SemaCXX/array-bounds.cpp b/clang/test/SemaCXX/array-bounds.cpp
index c1b37011727..8d0b1e4e30b 100644
--- a/clang/test/SemaCXX/array-bounds.cpp
+++ b/clang/test/SemaCXX/array-bounds.cpp
@@ -73,17 +73,21 @@ void test() {
(*array_ptr)[3] = 1; // expected-warning {{array index 3 is past the end of the array (which contains 2 elements)}}
}
+// FIXME: we should see the next note only 3 times and the following warning once, not twice
+// since it is independent of the template parameter 'I'.
template <int I> struct S {
- char arr[I]; // expected-note 2 {{declared here}}
+ char arr[I]; // expected-note 4 {{declared here}}
};
template <int I> void f() {
S<3> s;
- s.arr[4] = 0; // expected-warning {{array index 4 is past the end of the array (which contains 3 elements)}}
- s.arr[I] = 0; // expected-warning {{array index 5 is past the end of the array (which contains 3 elements)}}
+ s.arr[4] = 0; // expected-warning 2 {{array index 4 is past the end of the array (which contains 3 elements)}}
+ s.arr[I] = 0; // expected-warning {{array index 5 is past the end of the array (which contains 3 elements)}} \
+ expected-warning {{array index 3 is past the end of the array (which contains 3 elements)}}
}
void test_templates() {
f<5>(); // expected-note {{in instantiation}}
+ f<3>(); // expected-note {{in instantiation}}
}
#define SIZE 10
OpenPOWER on IntegriCloud