33 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s2 3namespace 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 } // namespace10 template <typename T>11 int foo(void) {12 return abc + abc_template<int> + abc_template<long>;13 }14}15 16namespace 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}33