testsuite: update mangling
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / constexpr-98122.C
blobb0c91d5ef97ab72667669dabb5485a27c9aaeef8
1 // PR c++/98122
2 // { dg-do compile { target c++20 } }
4 union V { int a; char b; };
5 union W { int a; int b; };
7 constexpr bool
8 bar ()
10   V f { .b = 42 };
11   constexpr auto m = &V::a;
12   return (f.*m) == 42;  // { dg-error "accessing 'V::a' member instead of initialized 'V::b' member in constant expression" }
15 constexpr bool
16 baz ()
18   W f { .b = 42 };
19   constexpr auto m = &W::b;
20   return (f.*m) == 42;
23 static_assert (bar (), "");     // { dg-error "non-constant condition for static assertion" }
24                                 // { dg-message "in .constexpr. expansion" "" { target *-*-* } .-1 }
25 static_assert (baz (), "");