xref: /llvm-project/clang/test/C/C99/n782.c (revision 3cf9f2c3a4b3aaffa9c1dbbe34624bcaabefd390)
1 /* RUN: %clang_cc1 -verify -std=c99 -pedantic %s
2    RUN: %clang_cc1 -verify=c89 -std=c89 -pedantic %s
3    expected-no-diagnostics
4  */
5 
6 /* WG14 N782: Clang 3.4
7  * Relaxed constraints on aggregate and union initialization
8  */
9 
test(void)10 void test(void) {
11   struct S {
12     int x, y;
13   };
14   int a = 1, b = 2;
15   struct S s = { a, b }; /* c89-warning {{initializer for aggregate is not a compile-time constant}} */
16 
17   union U {
18     int x;
19     float f;
20   };
21   union U u = { a }; /* c89-warning {{initializer for aggregate is not a compile-time constant}} */
22 }
23 
24