From 9092c3e0fa01f3139b016d05d267a89e3b07747a Mon Sep 17 00:00:00 2001 From: rdivacky Date: Wed, 14 Oct 2009 18:03:49 +0000 Subject: Update clang to r84119. --- test/SemaCXX/warn-char-subscripts.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/SemaCXX/warn-char-subscripts.cpp (limited to 'test/SemaCXX/warn-char-subscripts.cpp') diff --git a/test/SemaCXX/warn-char-subscripts.cpp b/test/SemaCXX/warn-char-subscripts.cpp new file mode 100644 index 0000000..1c06db9 --- /dev/null +++ b/test/SemaCXX/warn-char-subscripts.cpp @@ -0,0 +1,21 @@ +// RUN: clang-cc -Wchar-subscripts -fsyntax-only -verify %s + +template +void t1() { + int array[1] = { 0 }; + T subscript = 0; + int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}} +} + +template +void t2() { + int array[1] = { 0 }; + T subscript = 0; + int val = subscript[array]; // expected-warning{{array subscript is of type 'char'}} +} + +void test() { + t1(); // expected-note {{in instantiation of function template specialization 't1' requested here}} + t2(); // expected-note {{in instantiation of function template specialization 't2' requested here}} +} + -- cgit v1.1