2009-03-24 10:24:46 +08:00
|
|
|
/* RUN: clang-cc %s -fsyntax-only -pedantic -verify
|
2008-02-15 14:03:44 +08:00
|
|
|
*/
|
|
|
|
|
2008-11-24 07:12:31 +08:00
|
|
|
extern struct {int a;} x; // expected-note {{previous definition is here}}
|
|
|
|
extern struct {int a;} x; // expected-error {{redefinition of 'x'}}
|
2008-02-15 14:03:44 +08:00
|
|
|
|
|
|
|
struct x;
|
|
|
|
int a(struct x* b) {
|
|
|
|
// Per C99 6.7.2.3, since the outer and inner "struct x"es have different
|
|
|
|
// scopes, they don't refer to the same type, and are therefore incompatible
|
2008-11-24 07:12:31 +08:00
|
|
|
struct x {int a;} *c = b; // expected-warning {{incompatible pointer types}}
|
2008-02-15 14:03:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
struct x {int a;} r;
|
|
|
|
int b() {
|
2008-11-24 07:12:31 +08:00
|
|
|
struct x {char x;} s = r; // expected-error {{incompatible type initializing}}
|
2008-02-15 14:03:44 +08:00
|
|
|
}
|