public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113713] New: static_assert result depends on optimization settings
@ 2024-02-02  8:08 fchelnokov at gmail dot com
  2024-02-02  8:17 ` [Bug c++/113713] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fchelnokov at gmail dot com @ 2024-02-02  8:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113713

            Bug ID: 113713
           Summary: static_assert result depends on optimization settings
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This program

struct A{};

constexpr bool p(auto) { return false; }
constexpr bool f(auto v) { return p(v); }
constexpr bool g() { return f(A()); }
constexpr bool p(A) { return true; }

static_assert( f(A{}) );

The static_assert passes in GCC only with -O0 command line option, and it fails
with -O1 and higher optimization options, which looks wrong. Online demo:
https://godbolt.org/z/vWq8G7rn4

Related discussion: https://stackoverflow.com/q/77923182/7325599

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

end of thread, other threads:[~2024-02-02 15:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-02  8:08 [Bug c++/113713] New: static_assert result depends on optimization settings fchelnokov at gmail dot com
2024-02-02  8:17 ` [Bug c++/113713] " pinskia at gcc dot gnu.org
2024-02-02  8:28 ` pinskia at gcc dot gnu.org
2024-02-02  8:34 ` [Bug c++/113713] constexpr function values (incorrectly?) depend on optimization level pinskia at gcc dot gnu.org
2024-02-02 15:11 ` mpolacek at gcc dot gnu.org

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).