Argyrios Kyrtzidis | 22cd9ac | 2012-09-10 22:04:22 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -cc1 %s -include %s |
| 2 | // RUN: %clang_cc1 -cc1 %s -emit-pch -o %t.pch |
| 3 | // RUN: %clang_cc1 -cc1 %s -include-pch %t.pch |
| 4 | |
| 5 | // rdar://12239321 Make sure we don't emit a bogus |
| 6 | // error: field designator 'e' does not refer to a non-static data member |
| 7 | |
| 8 | #ifndef HEADER |
| 9 | #define HEADER |
| 10 | //===----------------------------------------------------------------------===// |
| 11 | |
| 12 | struct U { |
| 13 | union { |
| 14 | struct { |
| 15 | int e; |
| 16 | int f; |
| 17 | }; |
| 18 | |
| 19 | int a; |
| 20 | }; |
| 21 | }; |
| 22 | |
| 23 | //===----------------------------------------------------------------------===// |
| 24 | #else |
| 25 | #if !defined(HEADER) |
| 26 | # error Header inclusion order messed up |
| 27 | #endif |
| 28 | //===----------------------------------------------------------------------===// |
| 29 | |
| 30 | void bar() { |
| 31 | static const struct U plan = { .e = 1 }; |
| 32 | } |
| 33 | |
| 34 | //===----------------------------------------------------------------------===// |
| 35 | #endif |