1// RUN: %clang_cc1 -verify -fsyntax-only %s 2 3static int g0; // expected-note{{previous definition}} 4int g0; // expected-error{{non-static declaration of 'g0' follows static declaration}} 5 6static int g1; 7extern int g1; 8 9static int g2; 10__private_extern__ int g2; 11 12int g3; // expected-note{{previous definition}} 13static int g3; // expected-error{{static declaration of 'g3' follows non-static declaration}} 14 15extern int g4; // expected-note{{previous definition}} 16static int g4; // expected-error{{static declaration of 'g4' follows non-static declaration}} 17 18__private_extern__ int g5; // expected-note{{previous definition}} 19static int g5; // expected-error{{static declaration of 'g5' follows non-static declaration}} 20 21void f0() { 22 int g6; // expected-note {{previous}} 23 extern int g6; // expected-error {{extern declaration of 'g6' follows non-extern declaration}} 24} 25 26void f1() { 27 int g7; // expected-note {{previous}} 28 __private_extern__ int g7; // expected-error {{extern declaration of 'g7' follows non-extern declaration}} 29} 30 31void f2() { 32 extern int g8; // expected-note{{previous definition}} 33 int g8; // expected-error {{non-extern declaration of 'g8' follows extern declaration}} 34} 35 36void f3() { 37 __private_extern__ int g9; // expected-note{{previous definition}} 38 int g9; // expected-error {{non-extern declaration of 'g9' follows extern declaration}} 39} 40 41void f4() { 42 extern int g10; 43 extern int g10; 44} 45 46void f5() { 47 __private_extern__ int g11; 48 __private_extern__ int g11; 49} 50 51void f6() { 52 // FIXME: Diagnose 53 extern int g12; 54 __private_extern__ int g12; 55} 56 57void f7() { 58 // FIXME: Diagnose 59 __private_extern__ int g13; 60 extern int g13; 61} 62 63struct s0; 64void f8() { 65 extern struct s0 g14; 66 __private_extern__ struct s0 g14; 67} 68struct s0 { int x; }; 69 70void f9() { 71 extern int g15 = 0; // expected-error{{'extern' variable cannot have an initializer}} 72 // FIXME: linkage specifier in warning. 73 __private_extern__ int g16 = 0; // expected-error{{'extern' variable cannot have an initializer}} 74} 75 76extern int g17; 77int g17 = 0; 78 79extern int g18 = 0; // expected-warning{{'extern' variable has an initializer}} 80 81__private_extern__ int g19; 82int g19 = 0; 83 84__private_extern__ int g20 = 0; 85