1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 int outer1
; // expected-note{{previous definition is here}}
4 extern int outer2
; // expected-note{{previous declaration is here}}
6 int outer4
; // expected-note{{previous definition is here}}
8 int outer6(float); // expected-note{{previous definition is here}}
11 void outer_test(void) {
12 extern float outer1
; // expected-error{{redeclaration of 'outer1' with a different type}}
13 extern float outer2
; // expected-error{{redeclaration of 'outer2' with a different type}}
14 extern float outer3
; // expected-note{{previous declaration is here}}
16 extern int outer5
; // expected-note{{previous declaration is here}}
17 extern int outer6
; // expected-error{{redefinition of 'outer6' as different kind of symbol}}
19 extern int outer8
; // expected-note{{previous definition is here}}
22 extern int outer9
; // expected-note{{previous declaration is here}}
26 int outer3
; // expected-error{{redefinition of 'outer3' with a different type}}
27 float outer4
; // expected-error{{redefinition of 'outer4' with a different type}}
28 float outer5
; // expected-error{{redefinition of 'outer5' with a different type}}
29 int outer8(int); // expected-error{{redefinition of 'outer8' as different kind of symbol}}
30 float outer9
; // expected-error{{redefinition of 'outer9' with a different type}}
32 extern int outer13
; // expected-note{{previous declaration is here}}
33 void outer_shadowing_test(void) {
35 extern int outer11
; // expected-note{{previous declaration is here}}
36 extern int outer12
; // expected-note{{previous declaration is here}}
42 extern int outer10
; // okay
43 extern float outer11
; // expected-error{{redeclaration of 'outer11' with a different type}}
44 static double outer12
;
46 extern float outer12
; // expected-error{{redeclaration of 'outer12' with a different type}}
47 extern float outer13
; // expected-error{{redeclaration of 'outer13' with a different type}}
53 void g18(void) { // expected-note{{'g18' declared here}}
56 int *p
=&g19
; // expected-error{{use of undeclared identifier 'g19'}} \
57 // expected-warning{{incompatible pointer types}}
61 extern int a
; // expected-note {{previous declaration is here}}
62 int a
; // expected-error {{non-static declaration of 'a' follows static declaration}}
64 void f(int x
) { // expected-note {{previous definition is here}}
65 extern int x
; // expected-error {{extern declaration of 'x' follows non-extern declaration}}
69 void g20(void) { extern int b
[3]; } // expected-note{{previous declaration is here}}
70 void g21(void) { extern int b
[4]; } // expected-error{{redeclaration of 'b' with a different type: 'int[4]' vs 'int[3]'}}