Debian Codegraph @

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

raw
1 // Test that late-parsed default args have the same consteval semantics.
2 // { dg-do compile { target c++20 } }
3
4 consteval bool foo (bool x) { if (x) throw 1; return false; }
5 consteval bool bar (bool x = foo (true)) { return true; }
6 struct S
7 {
8 consteval static bool baz (bool x = foo (true)) { return true; }
9 };
10 constexpr bool a = bar (true);
11 constexpr bool b = S::baz (true);