https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103295
--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:6afa1083c6ee7b31629fb0c16299b952cb17868c commit r12-5343-g6afa1083c6ee7b31629fb0c16299b952cb17868c Author: Jonathan Wakely <jwak...@redhat.com> Date: Wed Nov 17 10:23:14 2021 +0000 libstdc++: Set active member of union in std::string [PR103295] Clang diagnoses that the new constexpr std::string constructors are not usable in constant expressions, because they start to write to members of the union without setting an active member. This adds a new helper function which returns the address of the local buffer after making it the active member. This doesn't fix all problems with Clang, because it still refuses to write to memory returned by the allocator. libstdc++-v3/ChangeLog: PR libstdc++/103295 * include/bits/basic_string.h (_M_use_local_data()): New member function to make local buffer the active member. (assign(const basic_string&)): Use it. * include/bits/basic_string.tcc (_M_construct, reserve()): Likewise.