2008-01-30 08:44:01 +08:00
|
|
|
// RUN: clang %s -verify -fsyntax-only
|
|
|
|
|
|
|
|
const int a [1] = {1};
|
|
|
|
extern const int a[];
|
|
|
|
|
|
|
|
extern const int b[];
|
|
|
|
const int b [1] = {1};
|
|
|
|
|
|
|
|
extern const int c[] = {1}; // expected-warning{{'extern' variable has an initializer}}
|
|
|
|
const int c[];
|
|
|
|
|
2008-11-24 07:12:31 +08:00
|
|
|
int i1 = 1; // expected-note {{previous definition is here}}
|
|
|
|
int i1 = 2; // expected-error {{redefinition of 'i1'}} // expected-note {{previous definition is here}}
|
2008-08-09 01:50:35 +08:00
|
|
|
int i1;
|
2008-01-30 08:44:01 +08:00
|
|
|
int i1;
|
2008-11-24 07:12:31 +08:00
|
|
|
extern int i1; // expected-note {{previous definition is here}}
|
|
|
|
static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}} expected-note {{previous definition is here}}
|
2008-08-09 01:50:35 +08:00
|
|
|
int i1 = 3; // expected-error{{redefinition of 'i1'}} expected-error{{non-static declaration of 'i1' follows static declaration}}
|
2008-01-30 08:44:01 +08:00
|
|
|
|
2008-05-13 06:36:43 +08:00
|
|
|
__private_extern__ int pExtern;
|
|
|
|
int pExtern = 0;
|
|
|
|
|
2008-08-09 01:50:35 +08:00
|
|
|
int i4;
|
|
|
|
int i4;
|
|
|
|
extern int i4;
|
|
|
|
|
2008-08-10 00:04:40 +08:00
|
|
|
int (*pToArray)[];
|
|
|
|
int (*pToArray)[8];
|
|
|
|
|
2008-08-10 23:20:13 +08:00
|
|
|
int redef[10];
|
2008-11-24 07:12:31 +08:00
|
|
|
int redef[]; // expected-note {{previous definition is here}}
|
2008-08-10 23:20:13 +08:00
|
|
|
int redef[11]; // expected-error{{redefinition of 'redef'}}
|
|
|
|
|
2008-01-30 08:44:01 +08:00
|
|
|
void func() {
|
2008-11-24 07:12:31 +08:00
|
|
|
extern int i1; // expected-note {{previous definition is here}}
|
2008-01-30 08:44:01 +08:00
|
|
|
static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}}
|
|
|
|
}
|
2008-09-17 22:05:40 +08:00
|
|
|
|
|
|
|
void func2(void)
|
|
|
|
{
|
|
|
|
extern double *p;
|
|
|
|
extern double *p;
|
|
|
|
}
|