xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/field-designator.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -include %s
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -emit-pch -o %t.pch
3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -include-pch %t.pch
4f4a2713aSLionel Sambuc 
5f4a2713aSLionel Sambuc // rdar://12239321 Make sure we don't emit a bogus
6f4a2713aSLionel Sambuc //     error: field designator 'e' does not refer to a non-static data member
7f4a2713aSLionel Sambuc 
8f4a2713aSLionel Sambuc #ifndef HEADER
9f4a2713aSLionel Sambuc #define HEADER
10f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
11f4a2713aSLionel Sambuc 
12f4a2713aSLionel Sambuc struct U {
13f4a2713aSLionel Sambuc   union {
14f4a2713aSLionel Sambuc     struct {
15f4a2713aSLionel Sambuc       int e;
16f4a2713aSLionel Sambuc       int f;
17f4a2713aSLionel Sambuc     };
18f4a2713aSLionel Sambuc 
19f4a2713aSLionel Sambuc     int a;
20f4a2713aSLionel Sambuc   };
21f4a2713aSLionel Sambuc };
22f4a2713aSLionel Sambuc 
23f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
24f4a2713aSLionel Sambuc #else
25f4a2713aSLionel Sambuc #if !defined(HEADER)
26f4a2713aSLionel Sambuc # error Header inclusion order messed up
27f4a2713aSLionel Sambuc #endif
28f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
29f4a2713aSLionel Sambuc 
bar()30f4a2713aSLionel Sambuc void bar() {
31f4a2713aSLionel Sambuc   static const struct U plan = { .e = 1 };
32f4a2713aSLionel Sambuc }
33f4a2713aSLionel Sambuc 
34f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===//
35f4a2713aSLionel Sambuc #endif
36