24 lines · c
1/* RUN: %clang_cc1 -verify -std=c99 -pedantic %s2 RUN: %clang_cc1 -verify=c89 -std=c89 -pedantic %s3 expected-no-diagnostics4 */5 6/* WG14 N782: Clang 3.47 * Relaxed constraints on aggregate and union initialization8 */9 10void 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