gcc/testsuite/g++.dg/cpp2a/consteval-defarg3.C
raw| 1 | // DR 2631: default args and DMI aren't immediately evaluated |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | // { dg-final { scan-assembler-not "foober" } } |
| 4 | |
| 5 | consteval int foober(); |
| 6 | |
| 7 | int g(int = foober()); |
| 8 | struct A { int i = foober(); }; |
| 9 | template <int i = foober()> struct B { }; |
| 10 | struct C |
| 11 | { |
| 12 | consteval C(int = foober()) { } |
| 13 | }; |
| 14 | int h(C = C()); |
| 15 | |
| 16 | consteval int foober() { return 42; } |
| 17 | |
| 18 | int main() { |
| 19 | A a; |
| 20 | B<> b; |
| 21 | g(); |
| 22 | h(); |
| 23 | } |