Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / warn-variable-not-needed.cpp
blob103be189068f86df09ae58d21a609a4778ef1007
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
3 namespace test1 {
4 static int abc = 42; // expected-warning {{variable 'abc' is not needed and will not be emitted}}
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>;
16 namespace test2 {
17 struct bah {
19 namespace {
20 struct foo : bah {
21 static char bar;
22 virtual void zed();
24 void foo::zed() {
25 bar++;
27 char foo::bar=0;
29 bah *getfoo() {
30 return new foo();