public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/113653] New: Failure to diagnose use of (non-constant-expr) const objects in static initializers
@ 2024-01-29 14:18 bugdal at aerifal dot cx
  2024-01-29 14:19 ` [Bug c/113653] " bugdal at aerifal dot cx
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: bugdal at aerifal dot cx @ 2024-01-29 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113653
           Summary: Failure to diagnose use of (non-constant-expr) const
                    objects in static initializers
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bugdal at aerifal dot cx
  Target Milestone: ---

The following is a constraint violation:

int foo()
{
    static const int x = 1;
    static const int y = x; // not a constant expression
    return y;
}

However, gcc does not diagnose it as such, even with -Wall -Wextra.

This appears to have been a regression somewhere between the gcc 4 era and now.

I'm not sure what component this should be assigned to. I chose "c" because
it's C-specific that this is not a constant expression; it would be in C++.

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

end of thread, other threads:[~2024-01-29 17:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-29 14:18 [Bug c/113653] New: Failure to diagnose use of (non-constant-expr) const objects in static initializers bugdal at aerifal dot cx
2024-01-29 14:19 ` [Bug c/113653] " bugdal at aerifal dot cx
2024-01-29 16:44 ` pinskia at gcc dot gnu.org
2024-01-29 16:46 ` pinskia at gcc dot gnu.org
2024-01-29 16:52 ` bugdal at aerifal dot cx
2024-01-29 16:55 ` pinskia at gcc dot gnu.org
2024-01-29 17:12 ` bugdal at aerifal dot cx

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