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

            Bug ID: 111173
           Summary: G++ allows constinit functions
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janschultke at googlemail dot com
  Target Milestone: ---

## Code to Reproduce

using Function = int();
constinit Function f;


## Expected Output (provided by clang trunk)

<source>:2:1: error: constinit can only be used in variable declarations
    2 | constinit Function f;
      | ^
1 error generated.


## Actual Output (https://godbolt.org/z/7rdEhhj1s)

This code compiles with any version of GCC that supports C++20 from what I
could tell. constinit looks to have no effect.

Reply via email to