blob: 84ea536b979e71dad528582015e67f46295878c2 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -Wchar-subscripts -fsyntax-only -verify %s
Sam Weinig76e2b712009-09-14 01:58:58 +00002
3template<typename T>
4void t1() {
5 int array[1] = { 0 };
6 T subscript = 0;
7 int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}}
8}
9
10template<typename T>
11void t2() {
12 int array[1] = { 0 };
13 T subscript = 0;
14 int val = subscript[array]; // expected-warning{{array subscript is of type 'char'}}
15}
16
17void test() {
18 t1<char>(); // expected-note {{in instantiation of function template specialization 't1<char>' requested here}}
19 t2<char>(); // expected-note {{in instantiation of function template specialization 't2<char>' requested here}}
20}
21