libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / c23-tag-alias-3.c
blob76bc4dfcd23aa72507f8b6c4fce317b11bcef510
1 /* { dg-do run { target lto } }
2 * { dg-options "-std=c23 -O2" }
3 */
5 /* These tests check that definitions of enums with
6 * the same underlying type can alias, even when
7 * they are not compatible. */
9 enum bar : long { A = 1, B = 3 };
11 int test_bar(enum bar* a, void* b)
13 *a = A;
15 enum foo : long { C = 2, D = 4 }* p = b;
16 *p = B;
18 return *a;
22 int main()
24 enum bar z;
26 if (B != test_bar(&z, &z))
27 __builtin_abort();
29 return 0;