teak-llvm/clang/test/SemaCXX/warn-variable-not-needed.cpp
Rafael Espindola 48cf0dc360 Add a basic testcase for the "variable is not needed" warning and one that
regressed in r168519.

llvm-svn: 168563
2012-11-25 14:00:51 +00:00

28 lines
477 B
C++

// 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();
}
}