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

            Bug ID: 118883
           Summary: [C++17] Incorrectly requires initializer for static
                    constexpr class-member
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: foom at fuhm dot net
  Target Milestone: ---

The following ought to be accepted in C++17 and later:
```
struct Foo {int* x = 0;};
class Bar {
    static constexpr Foo foo;
};
```

But GCC it rejects with `error: 'constexpr' static data member 'foo' must have
an initializer`.

The requirement was removed by P0386r2, which modified class.data.static from
"shall specify a brace­-or-­equal-­initializer" to "may specify a
brace-or-equal-initializer".

Reply via email to