1*f4a2713aSLionel Sambuc /* RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify 2*f4a2713aSLionel Sambuc */ 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc extern struct {int a;} x; // expected-note {{previous definition is here}} 5*f4a2713aSLionel Sambuc extern struct {int a;} x; // expected-error {{redefinition of 'x'}} 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc struct x; a(struct x * b)8*f4a2713aSLionel Sambucint a(struct x* b) { 9*f4a2713aSLionel Sambuc // Per C99 6.7.2.3, since the outer and inner "struct x"es have different 10*f4a2713aSLionel Sambuc // scopes, they don't refer to the same type, and are therefore incompatible 11*f4a2713aSLionel Sambuc struct x {int a;} *c = b; // expected-warning {{incompatible pointer types}} 12*f4a2713aSLionel Sambuc } 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc struct x {int a;} r; b()15*f4a2713aSLionel Sambucint b() { 16*f4a2713aSLionel Sambuc struct x {char x;} s = r; // expected-error {{initializing 'struct x' with an expression of incompatible type 'struct x'}} 17*f4a2713aSLionel Sambuc } 18