tentative-decls.c revision 5f4a6829dc58cab2f76e2b98492859aa3b91e3f2
1// RUN: clang %s -verify -fsyntax-only 2 3const int a [1] = {1}; 4extern const int a[]; 5 6extern const int b[]; 7const int b [1] = {1}; 8 9extern const int c[] = {1}; // expected-warning{{'extern' variable has an initializer}} 10const int c[]; 11 12int i1 = 1; // expected-note {{previous definition is here}} 13int i1 = 2; // expected-error {{redefinition of 'i1'}} // expected-note {{previous definition is here}} 14int i1; 15int i1; 16extern int i1; // expected-note {{previous definition is here}} 17static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}} expected-note {{previous definition is here}} 18int i1 = 3; // expected-error{{redefinition of 'i1'}} expected-error{{non-static declaration of 'i1' follows static declaration}} 19 20__private_extern__ int pExtern; 21int pExtern = 0; 22 23int i4; 24int i4; 25extern int i4; 26 27int (*pToArray)[]; 28int (*pToArray)[8]; 29 30int redef[10]; 31int redef[]; // expected-note {{previous definition is here}} 32int redef[11]; // expected-error{{redefinition of 'redef'}} 33 34void func() { 35 extern int i1; // expected-note {{previous definition is here}} 36 static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}} 37} 38 39void func2(void) 40{ 41 extern double *p; 42 extern double *p; 43} 44