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

            Bug ID: 116967
           Summary: Accepts-invalid missing constinit specifier on
                    initializing declaration
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janschultke at googlemail dot com
  Target Milestone: ---

extern constinit int x;
int x;


This TU violates https://eel.is/c++draft/dcl.constinit#1.sentence-2:

> If the [constinit] specifier is applied to any declaration of a variable,
> it shall be applied to the initializing declaration.

However, GCC accepts this program with no warnings:
https://godbolt.org/z/9naoPWKnq (unlike Clang and MSVC, which warn and error,
respectively)

Reply via email to