public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/110493] New: 'is not a constant expression' for function-local static std::initializer_list<std::string> with fsanitize=undefined
@ 2023-06-30  4:29 ed at catmur dot uk
  2023-06-30  4:32 ` [Bug libstdc++/110493] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ed at catmur dot uk @ 2023-06-30  4:29 UTC (permalink / raw)
  To: gcc-bugs

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>?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-30  7:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30  4:29 [Bug libstdc++/110493] New: 'is not a constant expression' for function-local static std::initializer_list<std::string> with fsanitize=undefined ed at catmur dot uk
2023-06-30  4:32 ` [Bug libstdc++/110493] " pinskia at gcc dot gnu.org
2023-06-30  4:42 ` pinskia at gcc dot gnu.org
2023-06-30  4:42 ` [Bug c++/110493] " pinskia at gcc dot gnu.org
2023-06-30  7:49 ` ed at catmur dot uk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).