Debian Codegraph @

clang/test/SemaCXX/warn-variable-not-needed.cpp

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
2
3 namespace test1 {
4 static int abc = 42; // expected-warning {{variable 'abc' is not needed and will not be emitted}}
5
6 namespace {
7 template <typename T> int abc_template = 0;
8 template <> int abc_template<int> = 0; // expected-warning {{variable 'abc_template<int>' is not needed and will not be emitted}}
9 } // namespace
10 template <typename T>
11 int foo(void) {
12 return abc + abc_template<int> + abc_template<long>;
13 }
14 }
15
16 namespace test2 {
17 struct bah {
18 };
19 namespace {
20 struct foo : bah {
21 static char bar;
22 virtual void zed();
23 };
24 void foo::zed() {
25 bar++;
26 }
27 char foo::bar=0;
28 }
29 bah *getfoo() {
30 return new foo();
31 }
32 }