https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112642
--- Comment #7 from Miro Palmu <miro.palmu at helsinki dot fi> --- (In reply to Jonathan Wakely from comment #6) > The examples in comment 4 do compile using libstdc++ on clang, if you use > libstdc++ headers from after sept 29 (for trunk) or oct 21 (for gcc-13). I was testing this on compiler explorer on clang 17.0.1 and it used gcc-13.2.0 libstdc++. Also tried it locally with clang 16.0.6 with gcc-13.2.1 libstdc++ Output: $ cat prog.cpp #include <string> #include <utility> int main() { [](std::string s = {}) consteval { std::string ss{ std::move(s) }; }(); } $ clang prog.cpp -std=c++2b -stdlib=libstdc++ prog.cpp:4:5: error: call to consteval function 'main()::(anonymous class)::operator()' is not a constant expression [](std::string s = {}) consteval { ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/stl_construct.h:97:14: note: construction of subobject of member '_M_local_buf' of union with no active member is not allowed in a constant expression { return ::new((void*)__location) _Tp(std::forward<_Args>(__args)...); } ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/char_traits.h:272:6: note: in call to 'construct_at(&ss.._M_local_buf[0], s.._M_local_buf[0])' std::construct_at(__s1 + __i, __s2[__i]); ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/char_traits.h:443:11: note: in call to 'copy(&ss.._M_local_buf[0], &s.._M_local_buf[0], 1)' return __gnu_cxx::char_traits<char_type>::copy(__s1, __s2, __n); ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/basic_string.h:672:6: note: in call to 'copy(&ss.._M_local_buf[0], &s.._M_local_buf[0], 1)' traits_type::copy(_M_local_buf, __str._M_local_buf, ^ prog.cpp:5:21: note: in call to 'basic_string(s)' std::string ss{ std::move(s) }; ^ prog.cpp:4:5: note: in call to '&[](std::string s) { std::string ss{std::move(s)}; }->operator()({{{{}}, &s.._M_local_buf[0]}, 0, {._M_local_buf = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...}}})' [](std::string s = {}) consteval { ^ 1 error generated.