hanchenye-llvm-project/clang/test/Sema/warn-shadow.c

21 lines
660 B
C
Raw Normal View History

2010-03-17 05:50:59 +08:00
// 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 sin; // okay; 'sin' has not been declared, even though it's a builtin.
2010-03-17 05:50:59 +08:00
}