diff options
Diffstat (limited to 'clang/test/Sema/warn-shadow.c')
| -rw-r--r-- | clang/test/Sema/warn-shadow.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/Sema/warn-shadow.c b/clang/test/Sema/warn-shadow.c new file mode 100644 index 00000000000..f75c140be16 --- /dev/null +++ b/clang/test/Sema/warn-shadow.c @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -Wshadow %s + +int i; // expected-note {{previous declaration is here}} + +void foo() { + int pass1; + int i; // expected-warning {{declaration shadows a variable in the global scope}} \ + // expected-note {{previous declaration is here}} + { + int pass2; + int i; // expected-warning {{declaration shadows a local variable}} \ + // expected-note {{previous declaration is here}} + { + int pass3; + int i; // expected-warning {{declaration shadows a local variable}} + } + } + + int __sync_fetch_and_add; // expected-warning {{declaration shadows a global built-in function}} +} |

