Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/consteval-prop12.C

raw
1 // P2564R3
2 // { dg-do compile { target c++20 } }
3
4 consteval int
5 zero (int)
6 {
7 return 0;
8 }
9
10 constexpr int
11 f (auto i)
12 {
13 return zero (i);
14 }
15
16 constexpr int
17 g (auto)
18 {
19 // This call is a constant expression, so don't promote g.
20 return f (42);
21 }
22
23 void
24 do_test ()
25 {
26 g (2);
27 }
28
29 // Must work.
30 auto q = &g<int>;