blob: 7a374e05533e5e924975e20004e9c726b8159bfd [file] [log] [blame]
Steve Naroffb00247f2008-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
12int i1 = 1; // expected-error{{previous definition is here}}
13int i1 = 2; // expected-error{{redefinition of 'i1'}} // expected-error{{previous definition is here}}
Steve Naroffb5e78152008-08-08 17:50:35 +000014int i1;
Steve Naroffb00247f2008-01-30 00:44:01 +000015int i1;
16extern int i1; // expected-error{{previous definition is here}}
17static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}} expected-error{{previous definition is here}}
Steve Naroffb5e78152008-08-08 17:50:35 +000018int i1 = 3; // expected-error{{redefinition of 'i1'}} expected-error{{non-static declaration of 'i1' follows static declaration}}
Steve Naroffb00247f2008-01-30 00:44:01 +000019
Steve Naroff89301de2008-05-12 22:36:43 +000020__private_extern__ int pExtern;
21int pExtern = 0;
22
Steve Naroffb5e78152008-08-08 17:50:35 +000023int i4;
24int i4;
25extern int i4;
26
Steve Naroff12508172008-08-09 16:04:40 +000027int (*pToArray)[];
28int (*pToArray)[8];
29
Steve Naroffb00247f2008-01-30 00:44:01 +000030void func() {
31 extern int i1; // expected-error{{previous definition is here}}
32 static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}}
33}