aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/warn-shadow.c
blob: f75c140be16c4c1644d5bf3ee1308956fa42ba56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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}}
}