aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/consteval-prop12.C
blob: 2949ab83af86e8c3d55466b43375635416beaa83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// P2564R3
// { dg-do compile { target c++20 } }

consteval int
zero (int)
{
  return 0;
}

constexpr int
f (auto i)
{
  return zero (i);
}

constexpr int
g (auto)
{
  // This call is a constant expression, so don't promote g.
  return f (42);
}

void
do_test ()
{
  g (2);
}

// Must work.
auto q = &g<int>;