1 // RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s
2 template<typename T> void f() {
39 void test_dependent_init(T *p) {
45 template<typename T> class X;
48 X<char> str (read_from_file()); // expected-error{{use of undeclared identifier 'read_from_file'}}
52 void unused_local_static() {
54 static int y = 0; // expected-warning{{unused variable 'y'}}
60 // We expect a warning in the definition only for non-dependent variables, and
61 // a warning in the instantiation only for dependent variables.
65 int a; // expected-warning {{unused variable 'a'}}
66 T b; // expected-warning 2{{unused variable 'b'}}
72 int a; // expected-warning {{unused variable 'a'}}
73 T b; // expected-warning 2{{unused variable 'b'}}
77 S<int>().f(); // expected-note {{here}}
78 S<char>().f(); // expected-note {{here}}
79 f<int>(); // expected-note {{here}}
80 f<char>(); // expected-note {{here}}