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

            Bug ID: 118239
           Summary: [12/13/14/15 Regression] accepts invalid constexpr
                    variable definition
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
            Blocks: 55004
  Target Milestone: ---

Take:
```
struct NoMut1 { int a, b; };
struct NoMut3 : NoMut1 {
  constexpr NoMut3(int a, int b) /*: NoMut1()*/ {}
};
void mutable_subobjects() {
  constexpr NoMut3 nm3(1, 2);
}
```

This is invalid as NoMut1 needs to be explicitly initialized as explained by
EDG:
```
"<source>", line 3: error: constexpr constructor must initialize direct base
class "NoMut1"
    constexpr NoMut3(int a, int b) {}
                                   ^
```

This is correctly rejected for C++20 but incorrectly accepted for C++11, 14 and
17.

Noticed while looking into PR 118193.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55004
[Bug 55004] [meta-bug] constexpr issues

Reply via email to