blob: 0e4b13a8434d7bcef0183e4fdf3a7f636d9e0170 [file] [log] [blame]
Steve Naroffb7b032e2008-01-30 00:44:01 +00001// 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
Chris Lattner5f4a6822008-11-23 23:12:31 +000012int i1 = 1; // expected-note {{previous definition is here}}
13int i1 = 2; // expected-error {{redefinition of 'i1'}} // expected-note {{previous definition is here}}
Steve Naroffff9eb1f2008-08-08 17:50:35 +000014int i1;
Steve Naroffb7b032e2008-01-30 00:44:01 +000015int i1;
Chris Lattner5f4a6822008-11-23 23:12:31 +000016extern 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}}
Steve Naroffff9eb1f2008-08-08 17:50:35 +000018int i1 = 3; // expected-error{{redefinition of 'i1'}} expected-error{{non-static declaration of 'i1' follows static declaration}}
Steve Naroffb7b032e2008-01-30 00:44:01 +000019
Steve Naroff235549c2008-05-12 22:36:43 +000020__private_extern__ int pExtern;
21int pExtern = 0;
22
Steve Naroffff9eb1f2008-08-08 17:50:35 +000023int i4;
24int i4;
25extern int i4;
26
Steve Naroff907747b2008-08-09 16:04:40 +000027int (*pToArray)[];
28int (*pToArray)[8];
29
Steve Narofff855e6f2008-08-10 15:20:13 +000030int redef[10];
Chris Lattner5f4a6822008-11-23 23:12:31 +000031int redef[]; // expected-note {{previous definition is here}}
Steve Narofff855e6f2008-08-10 15:20:13 +000032int redef[11]; // expected-error{{redefinition of 'redef'}}
33
Steve Naroffb7b032e2008-01-30 00:44:01 +000034void func() {
Chris Lattner5f4a6822008-11-23 23:12:31 +000035 extern int i1; // expected-note {{previous definition is here}}
Steve Naroffb7b032e2008-01-30 00:44:01 +000036 static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}}
37}
Steve Naroff094cefb2008-09-17 14:05:40 +000038
39void func2(void)
40{
41 extern double *p;
42 extern double *p;
43}