xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/nested-redef.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc struct X { // expected-note{{previous definition is here}}
3*f4a2713aSLionel Sambuc   struct X { } x; // expected-error{{nested redefinition of 'X'}}
4*f4a2713aSLionel Sambuc };
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc struct Y { };
f(void)7*f4a2713aSLionel Sambuc void f(void) {
8*f4a2713aSLionel Sambuc   struct Y { }; // okay: this is a different Y
9*f4a2713aSLionel Sambuc }
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc struct T;
12*f4a2713aSLionel Sambuc struct Z {
13*f4a2713aSLionel Sambuc   struct T { int x; } t;
14*f4a2713aSLionel Sambuc   struct U { int x; } u;
15*f4a2713aSLionel Sambuc };
16*f4a2713aSLionel Sambuc 
f2(void)17*f4a2713aSLionel Sambuc void f2(void) {
18*f4a2713aSLionel Sambuc   struct T t;
19*f4a2713aSLionel Sambuc   struct U u;
20*f4a2713aSLionel Sambuc }
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc 
23