summaryrefslogtreecommitdiff
path: root/test/SemaCXX/warn-variable-not-needed.cpp
blob: 0fb0f8151b449722e223d0f1dc65b69b0b11e9fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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();
  }
}