blob: 6e79a0868fd4aa9eb2539a6753947e989028fa03 [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}}
14// FIXME: the following should not be an error (see related FIXME in Sema::MergeVarDecl).
15int i1; // expected-error{{redefinition of 'i1'}}
16int i1;
17extern int i1; // expected-error{{previous definition is here}}
18static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}} expected-error{{previous definition is here}}
19int i1 = 3; // expected-error{{non-static declaration of 'i1' follows static declaration}}
20
Steve Naroff89301de2008-05-12 22:36:43 +000021__private_extern__ int pExtern;
22int pExtern = 0;
23
Steve Naroffb00247f2008-01-30 00:44:01 +000024void func() {
25 extern int i1; // expected-error{{previous definition is here}}
26 static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}}
27}