https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99546
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2021-08-16 00:00:00 |2022-9-20 --- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to 康桓瑋 from comment #1) > You can see more weird cases in this: > https://stackoverflow.com/questions/66578966/weird-return-value-of-c20- > requires-expression. Copying that here instead of linking to impermanent SO comments: template <bool b> void foo() { static_assert(b); } int main() { constexpr bool b = requires { []{}; }; foo<!b>(); foo<b>(); } The bool appears to not be a constant expression: x.C: In function 'int main()': x.C:8:10: error: no matching function for call to 'foo<(!(bool)b)>()' 8 | foo<!b>(); | ~~~~~~~^~ x.C:2:6: note: candidate: 'template<bool b> void foo()' 2 | void foo() { | ^~~ x.C:2:6: note: template argument deduction/substitution failed: x.C:9:9: error: no matching function for call to 'foo<b>()' 9 | foo<b>(); | ~~~~~~^~ x.C:2:6: note: candidate: 'template<bool b> void foo()' 2 | void foo() { | ^~~ x.C:2:6: note: template argument deduction/substitution failed: