https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110493
Bug ID: 110493 Summary: 'is not a constant expression' for function-local static std::initializer_list<std::string> with fsanitize=undefined Product: gcc Version: 12.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: ed at catmur dot uk Target Milestone: --- Since 12.3.0, under -fsanitize=undefined -std=c++20: #include <initializer_list> #include <string> void f() { static auto a = {std::string()}; } error: '(((const std::__cxx11::basic_string<char>*)(& <temporary>)) != 0)' is not a constant expression Clearly this is an instance of bug 71962, but this is in fairly unexceptional code and could make ubsan unusable; it's not obvious that this code should have anything to do with constant evaluation. Since it only appears in a point release I would hope it might be possible to fix in library for this specific case, within <initializer_list>?