[Bug lto/105876] use of -flto with g++ changes global extern const std::string initialization in unexpected manner
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 7 19:53:12 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105876
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
const std::string MAIN_EXTERN_CONST_STRING= "a_literal_string_value";
...
static const std::string TEST_STATIC_CONST_STRING = MAIN_EXTERN_CONST_STRING;
MAIN_EXTERN_CONST_STRING is still dynamic intialized since the constructor of
std::string is non-consteval (well that is the C++20 term, for pre-C++20, it is
non-constexpr and non-trival).
More information about the Gcc-bugs
mailing list