https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111258
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note clang rejects (libstdc++ version) for a different reason: ``` <source>:12:20: error: static assertion expression is not an integral constant expression 12 | static_assert( foo("hello"s) == 'e' ); | ^~~~~~~~~~~~~~~~~~~~ /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/basic_string.h:626:2: note: undefined function '_M_construct<const char *>' cannot be used in a constant expression 626 | _M_construct(__s, __s + __n, std::forward_iterator_tag()); | ^ /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/basic_string.h:4686:14: note: in call to 'basic_string(&"hello"[0], 5, std::allocator<char>())' 4686 | { return basic_string<char>{__str, __len}; } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>:12:24: note: in call to 'operator""s(&"hello"[0], 5)' 12 | static_assert( foo("hello"s) == 'e' ); | ^~~~~~~~ /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/14.0.0/../../../../include/c++/14.0.0/bits/basic_string.h:336:9: note: declared here 336 | _M_construct(_FwdIterator __beg, _FwdIterator __end, | ^ ``` clang accepts LLVM's libc++ version though.