(root)/
gcc-13.2.0/
gcc/
testsuite/
g++.dg/
cpp2a/
consteval20.C
// PR c++/102753
// { dg-do compile { target c++20 } }

struct S {
  consteval int foo () const { return 42; }
};

constexpr S s;

int
bar ()
{
  auto c = &S::foo;			// { dg-error "taking address of an immediate function" }
  constexpr auto d = &S::foo;		// { dg-error "taking address of an immediate function" }
  static auto e = &S::foo;		// { dg-error "taking address of an immediate function" }
  return (s.*&S::foo) ();		// { dg-error "taking address of an immediate function" }
}

constexpr auto a = &S::foo;		// { dg-error "taking address of an immediate function" }
auto b = &S::foo;			// { dg-error "taking address of an immediate function" }

consteval int
baz ()
{
  return (s.*&S::foo) ();
}

static_assert (baz () == 42);