summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/warn-variable-not-needed.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/warn-variable-not-needed.cpp')
-rw-r--r--test/SemaCXX/warn-variable-not-needed.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-variable-not-needed.cpp b/test/SemaCXX/warn-variable-not-needed.cpp
new file mode 100644
index 0000000..0fb0f81
--- /dev/null
+++ b/test/SemaCXX/warn-variable-not-needed.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
+
+namespace test1 {
+ static int abc = 42; // expected-warning {{variable 'abc' is not needed and will not be emitted}}
+ template <typename T>
+ int foo(void) {
+ return abc;
+ }
+}
+
+namespace test2 {
+ struct bah {
+ };
+ namespace {
+ struct foo : bah {
+ static char bar;
+ virtual void zed();
+ };
+ void foo::zed() {
+ bar++;
+ }
+ char foo::bar=0;
+ }
+ bah *getfoo() {
+ return new foo();
+ }
+}
OpenPOWER on IntegriCloud