https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112642
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|libstdc++ |c++ --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- Or: #include <string> consteval void bar() { auto _ = [](std::string s) { return s; }({}); } int main() { bar(); } Or: #include <string> constexpr auto foo(std::string init) { return init; } constexpr auto bar() { return foo("").size(); } constexpr auto i = bar(); Clang compiles both of these without problems (it can't compile anything using ""s in a constant expression, maybe due to https://github.com/llvm/llvm-project/issues/68527) So I am pretty sure this is a g++ front end bug.