diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-14 18:03:49 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-14 18:03:49 +0000 |
| commit | 4c8b24812ddcd1dedaca343a6d4e76f91f398981 (patch) | |
| tree | 137ebebcae16fb0ce7ab4af456992bbd8d22fced /test/SemaCXX/warn-char-subscripts.cpp | |
| parent | 5362a71c02e7d448a8ce98cf00c47e353fba5d04 (diff) | |
Notes
Diffstat (limited to 'test/SemaCXX/warn-char-subscripts.cpp')
| -rw-r--r-- | test/SemaCXX/warn-char-subscripts.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-char-subscripts.cpp b/test/SemaCXX/warn-char-subscripts.cpp new file mode 100644 index 0000000000000..1c06db91c3f75 --- /dev/null +++ b/test/SemaCXX/warn-char-subscripts.cpp @@ -0,0 +1,21 @@ +// RUN: clang-cc -Wchar-subscripts -fsyntax-only -verify %s + +template<typename T> +void t1() { + int array[1] = { 0 }; + T subscript = 0; + int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}} +} + +template<typename T> +void t2() { + int array[1] = { 0 }; + T subscript = 0; + int val = subscript[array]; // expected-warning{{array subscript is of type 'char'}} +} + +void test() { + t1<char>(); // expected-note {{in instantiation of function template specialization 't1<char>' requested here}} + t2<char>(); // expected-note {{in instantiation of function template specialization 't2<char>' requested here}} +} + |
