Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Douglas Gregor | 72de667 | 2009-01-08 20:45:30 +0000 | [diff] [blame] | 2 | struct X { // expected-note{{previous definition is here}} |
Eli Friedman | 721e77d | 2009-12-07 00:22:08 +0000 | [diff] [blame] | 3 | struct X { } x; // expected-error{{nested redefinition of 'X'}} \ |
| 4 | // expected-error{{field has incomplete type}} |
Douglas Gregor | 72de667 | 2009-01-08 20:45:30 +0000 | [diff] [blame] | 5 | }; |
| 6 | |
| 7 | struct Y { }; |
| 8 | void f(void) { |
| 9 | struct Y { }; // okay: this is a different Y |
| 10 | } |
| 11 | |
| 12 | struct T; |
| 13 | struct Z { |
| 14 | struct T { int x; } t; |
| 15 | struct U { int x; } u; |
| 16 | }; |
| 17 | |
| 18 | void f2(void) { |
| 19 | struct T t; |
Douglas Gregor | 04495c8 | 2009-02-24 01:23:02 +0000 | [diff] [blame] | 20 | struct U u; |
Douglas Gregor | 72de667 | 2009-01-08 20:45:30 +0000 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | |