diff options
author | John McCall <rjmccall@apple.com> | 2010-03-16 21:50:59 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-03-16 21:50:59 +0000 |
commit | 9a9ae00442eddb3ec9e4d74a91c184b719382c4b (patch) | |
tree | e3bbeb6f270602e07be42a6b105493ae17953e68 /clang/test/SemaCXX/warn-shadow.cpp | |
parent | a2a3f7dc115d1574e6cdf87eb9c82ca017976d6e (diff) | |
download | bcm5719-llvm-9a9ae00442eddb3ec9e4d74a91c184b719382c4b.tar.gz bcm5719-llvm-9a9ae00442eddb3ec9e4d74a91c184b719382c4b.zip |
Forgot the testcases.
llvm-svn: 98685
Diffstat (limited to 'clang/test/SemaCXX/warn-shadow.cpp')
-rw-r--r-- | clang/test/SemaCXX/warn-shadow.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/warn-shadow.cpp b/clang/test/SemaCXX/warn-shadow.cpp new file mode 100644 index 00000000000..c637f42ea98 --- /dev/null +++ b/clang/test/SemaCXX/warn-shadow.cpp @@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -Wshadow %s + +namespace { + int i; // expected-note {{previous declaration is here}} +} + +namespace one { +namespace two { + int j; // expected-note {{previous declaration is here}} +} +} + +namespace xx { + int m; +} +namespace yy { + int m; +} + +using namespace one::two; +using namespace xx; +using namespace yy; + +void foo() { + int i; // expected-warning {{declaration shadows a variable in namespace '<anonymous>'}} + int j; // expected-warning {{declaration shadows a variable in namespace 'one::two'}} + int m; +} + +class A { + static int data; // expected-note {{previous declaration}} + int field; // expected-note {{previous declaration}} + + void test() { + char *field; // expected-warning {{declaration shadows a field of 'A'}} + char *data; // expected-warning {{declaration shadows a static data member of 'A'}} + } +}; |