testsuite: update mangling
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / constexpr-init7.C
blob2e62b5377b143966408529fd228b3c4a2a4500db
1 // PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
2 // { dg-do compile { target c++20 } }
4 struct S {
5   int a = 1;
6   constexpr S() = default;
7 };
9 constexpr S s;
11 union U {
12   int a = 1;
13   constexpr U() = default;
16 constexpr U u;
18 struct S2 {
19   int a;
20   constexpr S2() = default;
23 constexpr S2 s2; // { dg-error "uninitialized .const s2." }
25 union U2 {
26   int a;
27   constexpr U2() = default;
30 constexpr U2 u2; // { dg-error "uninitialized .const u2." }
32 struct S3 {
33   // FIXME if it's anonymous union, we don't give the error below
34   union {
35     int a;
36   } u;
37   constexpr S3() = default;
40 constexpr S3 s3; // { dg-error "uninitialized .const s3." }
42 struct S4 {
43   // FIXME if it's anonymous union, we don't give the error below
44   union {
45     int n;
46   } u;
47   constexpr S4() = default;
50 constexpr S4 s4; // { dg-error "uninitialized .const s4." }
52 struct S5 {
53   union {
54     int n = 0;
55   };
56   // FIXME if it's anonymous union, we don't give the error below
57   union {
58     int m;
59   } u;
60   constexpr S5() = default;
63 constexpr S5 s5; // { dg-error "uninitialized .const s5.|not a constant expression" }