forked from OSchip/llvm-project
Add -Warray-bounds test showing how the warning currently interoperates with macros.
llvm-svn: 125781
This commit is contained in:
parent
57d736fd46
commit
48d9626055
|
@ -74,3 +74,14 @@ template <int I> void f() {
|
|||
void test_templates() {
|
||||
f<5>(); // expected-note {{in instantiation}}
|
||||
}
|
||||
|
||||
#define SIZE 10
|
||||
#define ARR_IN_MACRO(flag, arr, idx) flag ? arr[idx] : 1
|
||||
|
||||
int test_no_warn_macro_unreachable() {
|
||||
int arr[SIZE]; // expected-note 2 {{array 'arr' declared here}}
|
||||
// FIXME: We don't want to warn for the first case.
|
||||
return ARR_IN_MACRO(0, arr, SIZE) + // expected-warning{{array index of '10' indexes past the end of an array (that contains 10 elements)}}
|
||||
ARR_IN_MACRO(1, arr, SIZE); // expected-warning{{array index of '10' indexes past the end of an array (that contains 10 elements)}}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue