aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/consteval23.C
blob: a6fdaa836de6b69bac5163cc9149b01cf02ad30c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// PR c++/102753
// { dg-do compile { target c++20 } }

consteval int foo () { return 42; }
constexpr auto baz (int (*fn) ()) { return fn; }

consteval int
bar (int (*fn) () = foo)
{
  return fn ();
}

static_assert (bar () == 42);
static_assert (bar (foo) == 42);
static_assert (bar (&foo) == 42);
static_assert (bar (baz (foo)) == 42);
static_assert (bar (baz (&foo)) == 42);