blob: 65a34e8fc25c38fa66b8075e2be326ddae066d3d [file] [log] [blame]
Sam Weinig76e2b712009-09-14 01:58:58 +00001// RUN: clang-cc -Wchar-subscripts -fsyntax-only -verify %s
2
3void t1() {
4 int array[1] = { 0 };
5 char subscript = 0;
6 int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}}
7}
8
9void t2() {
10 int array[1] = { 0 };
11 char subscript = 0;
12 int val = subscript[array]; // expected-warning{{array subscript is of type 'char'}}
13}
14
15void t3() {
16 int *array = 0;
17 char subscript = 0;
18 int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}}
19}
20
21void t4() {
22 int *array = 0;
23 char subscript = 0;
24 int val = subscript[array]; // expected-warning{{array subscript is of type 'char'}}
25}
26
27char returnsChar();
28void t5() {
29 int *array = 0;
30 int val = array[returnsChar()]; // expected-warning{{array subscript is of type 'char'}}
31}