John McCall | 9a9ae00 | 2010-03-16 21:50:59 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fsyntax-only -Wshadow %s |
| 2 | |
| 3 | int i; // expected-note {{previous declaration is here}} |
| 4 | |
| 5 | void foo() { |
| 6 | int pass1; |
| 7 | int i; // expected-warning {{declaration shadows a variable in the global scope}} \ |
| 8 | // expected-note {{previous declaration is here}} |
| 9 | { |
| 10 | int pass2; |
| 11 | int i; // expected-warning {{declaration shadows a local variable}} \ |
| 12 | // expected-note {{previous declaration is here}} |
| 13 | { |
| 14 | int pass3; |
| 15 | int i; // expected-warning {{declaration shadows a local variable}} |
| 16 | } |
| 17 | } |
| 18 | |
Douglas Gregor | 319aa6c | 2010-03-17 16:03:44 +0000 | [diff] [blame^] | 19 | int sin; // okay; 'sin' has not been declared, even though it's a builtin. |
John McCall | 9a9ae00 | 2010-03-16 21:50:59 +0000 | [diff] [blame] | 20 | } |