diff options
author | dim <dim@FreeBSD.org> | 2011-07-17 15:40:56 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-07-17 15:40:56 +0000 |
commit | 611ba3ea3300b71eb95dc4e45f20eee5dddd32e1 (patch) | |
tree | 2097d084eb235c0b12c0bff3445f4ec7bbaa8a12 /test/SemaCXX/warn-unused-variables.cpp | |
parent | c49018d9cce52d8c9f34b44865ec3ba8e89a1488 (diff) | |
download | FreeBSD-src-611ba3ea3300b71eb95dc4e45f20eee5dddd32e1.zip FreeBSD-src-611ba3ea3300b71eb95dc4e45f20eee5dddd32e1.tar.gz |
Vendor import of clang trunk r135360:
http://llvm.org/svn/llvm-project/cfe/trunk@135360
Diffstat (limited to 'test/SemaCXX/warn-unused-variables.cpp')
-rw-r--r-- | test/SemaCXX/warn-unused-variables.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-unused-variables.cpp b/test/SemaCXX/warn-unused-variables.cpp index 81f22a7..5ba1f2a 100644 --- a/test/SemaCXX/warn-unused-variables.cpp +++ b/test/SemaCXX/warn-unused-variables.cpp @@ -54,3 +54,29 @@ void unused_local_static() { static int y = 0; // expected-warning{{unused variable 'y'}} #pragma unused(x) } + +// PR10168 +namespace PR10168 { + // We expect a warning in the definition only for non-dependent variables, and + // a warning in the instantiation only for dependent variables. + template<typename T> + struct S { + void f() { + int a; // expected-warning {{unused variable 'a'}} + T b; // expected-warning 2{{unused variable 'b'}} + } + }; + + template<typename T> + void f() { + int a; // expected-warning {{unused variable 'a'}} + T b; // expected-warning 2{{unused variable 'b'}} + } + + void g() { + S<int>().f(); // expected-note {{here}} + S<char>().f(); // expected-note {{here}} + f<int>(); // expected-note {{here}} + f<char>(); // expected-note {{here}} + } +} |