testsuite: 32 bit AIX 2 byte wchar
[official-gcc.git] / gcc / testsuite / g++.dg / cpp23 / consteval-if11.C
bloba22736cc0063eb1009039faf649298c75754bb44
1 // PR c++/102753
2 // { dg-do compile { target c++20 } }
3 // { dg-options "" }
5 struct S {
6   constexpr S () : s (0) {}
7   consteval int foo () { return 1; }
8   virtual consteval int bar () { return 2; }
9   int s;
12 consteval int foo () { return 42; }
14 constexpr int
15 bar ()
17   if consteval {        // { dg-warning "'if consteval' only available with" "" { target c++20_only } }
18     int (*fn1) () = foo;
19     int (S::*fn2) () = &S::foo;
20     int (S::*fn3) () = &S::bar;
21     S s;
22     return fn1 () + (s.*fn2) () + (s.*fn3) ();
23   }
24   return 0;
27 static_assert (bar () == 45);