]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaCXX/warn-char-subscripts.cpp
Update clang to 84175.
[FreeBSD/FreeBSD.git] / test / SemaCXX / warn-char-subscripts.cpp
1 // RUN: clang-cc -Wchar-subscripts -fsyntax-only -verify %s
2
3 template<typename T>
4 void 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
10 template<typename T>
11 void 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
17 void 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