c++: prev declared hidden tmpl friend inst [PR112288]
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / consteval21.C
blob06ec705c75bc477783bc0c8d9d4f8d2c67aeeaae
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 };
11 consteval int foo () { return 42; }
13 consteval int
14 bar (int (*fn) () = &foo)
16   return fn ();
19 consteval int
20 baz (int (S::*fn) () = &S::foo)
22   S s;
23   return (s.*fn) ();
26 consteval int
27 qux (int (S::*fn) () = &S::bar)
29   S s;
30   return (s.*fn) ();
33 static_assert (bar () == 42);
34 static_assert (baz () == 1);
35 static_assert (qux () == 2);