testsuite: update mangling
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / consteval22.C
blob5c3637189dc0593228e5dbe2426f57531ee98cc3
1 // PR c++/102753
2 // { dg-do compile { target c++20 } }
4 struct S {
5   constexpr S () : s (0) {}
6   consteval int foo () { return 1; }
7   virtual consteval int bar () { return 2; }
8   int s;
9 };
10 typedef int (S::*P) ();
12 consteval P
13 foo ()
15   return &S::foo;
18 consteval P
19 bar ()
21   return &S::bar;
24 consteval int
25 baz ()
27   S s;
28   return (s.*(foo ())) () + (s.*(bar ())) ();
31 static_assert (baz () == 3);
33 constexpr P a = foo ();         // { dg-error "immediate evaluation returns address of immediate function" }
34 constexpr P b = bar ();         // { dg-error "immediate evaluation returns address of immediate function" }