xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/warn-variable-not-needed.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc namespace test1 {
4*f4a2713aSLionel Sambuc   static int abc = 42; // expected-warning {{variable 'abc' is not needed and will not be emitted}}
5*f4a2713aSLionel Sambuc   template <typename T>
foo(void)6*f4a2713aSLionel Sambuc   int foo(void) {
7*f4a2713aSLionel Sambuc     return abc;
8*f4a2713aSLionel Sambuc   }
9*f4a2713aSLionel Sambuc }
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc namespace test2 {
12*f4a2713aSLionel Sambuc   struct bah {
13*f4a2713aSLionel Sambuc   };
14*f4a2713aSLionel Sambuc   namespace {
15*f4a2713aSLionel Sambuc     struct foo : bah {
16*f4a2713aSLionel Sambuc       static char bar;
17*f4a2713aSLionel Sambuc       virtual void zed();
18*f4a2713aSLionel Sambuc     };
zed()19*f4a2713aSLionel Sambuc     void foo::zed() {
20*f4a2713aSLionel Sambuc       bar++;
21*f4a2713aSLionel Sambuc     }
22*f4a2713aSLionel Sambuc     char foo::bar=0;
23*f4a2713aSLionel Sambuc   }
getfoo()24*f4a2713aSLionel Sambuc   bah *getfoo() {
25*f4a2713aSLionel Sambuc     return new foo();
26*f4a2713aSLionel Sambuc   }
27*f4a2713aSLionel Sambuc }
28