aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/warn-unused-filescoped.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-01-03 04:29:20 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-01-03 04:29:20 +0000
commit6769ccb6853871c085c8366ab5e993841ad56d00 (patch)
tree145e2dea940867ad682d6553e517726852aa0f41 /test/SemaCXX/warn-unused-filescoped.cpp
parentda844b3483669c64d02082ff2a9e68d46bd00c1f (diff)
Warn on unused auto variables.
To do so we have to wait until we know that the type of a variable has been deduced. Sema::FinalizeDeclaration is the first callback that is used for decl with or without initializers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171458 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/warn-unused-filescoped.cpp')
-rw-r--r--test/SemaCXX/warn-unused-filescoped.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/SemaCXX/warn-unused-filescoped.cpp b/test/SemaCXX/warn-unused-filescoped.cpp
index 4cb38d997b..e12668bf2a 100644
--- a/test/SemaCXX/warn-unused-filescoped.cpp
+++ b/test/SemaCXX/warn-unused-filescoped.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wunused -Wunused-member-function -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wunused -Wunused-member-function -Wno-c++11-extensions -std=c++98 %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wunused -Wunused-member-function -std=c++11 %s
static void f1(); // expected-warning{{unused}}
@@ -132,3 +132,11 @@ namespace test6 {
void bar();
};
}
+
+namespace pr14776 {
+ namespace {
+ struct X {};
+ }
+ X a = X(); // expected-warning {{unused variable 'a'}}
+ auto b = X(); // expected-warning {{unused variable 'b'}}
+}