2 // { dg-do compile { target c++20 } }
5 consteval int foo () const { return 42; }
13 auto c = &S::foo; // { dg-error "taking address of an immediate function" }
14 constexpr auto d = &S::foo; // { dg-error "constant evaluation returns address of immediate function" }
15 static auto e = &S::foo; // { dg-error "taking address of an immediate function" }
16 return (s.*&S::foo) (); // { dg-error "taking address of an immediate function" }
19 constexpr auto a = &S::foo; // { dg-error "constant evaluation returns address of immediate function" }
20 auto b = &S::foo; // { dg-error "taking address of an immediate function" }
25 return (s.*&S::foo) ();
28 static_assert (baz () == 42);