https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118323
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Clang does better: esc.cc:8:3: error: call to immediate function 'func()::(anonymous class)::operator()' is not a constant expression 8 | []{ | ^ esc.cc:1:43: note: subexpression not valid in a constant expression 1 | consteval int check(int i) { if (i > 100) throw; return i; } | ^~~~~ esc.cc:9:10: note: in call to 'check(101)' 9 | funk(check(101)); | ^~~~~~~~~~ esc.cc:8:3: note: in call to '[] { funk(check(101)); }.operator()()' 8 | []{ | ^~~ 9 | funk(check(101)); | ~~~~~~~~~~~~~~~~~ 10 | }(); | ~~~ 1 error generated. EDG gives the exact same error with or without -DLAMBDA: "esc.cc", line 12: error: call to consteval function "check" did not produce a valid constant expression funk(check(101)); ^ "esc.cc", line 1: note: expression cannot be interpreted consteval int check(int i) { if (i > 100) throw; return i; } ^ 1 error detected in the compilation of "esc.cc".