[Bug c++/115900] [14/15 Regression] constexpr object modification during construction gives "Modifying a const object is not allowed in a constant expression"

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jul 12 20:31:52 GMT 2024


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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced slightly more:
```
struct A {
    char m;
    constexpr A() { m = 0; }
};

struct C {
  constexpr C(){ };
};

struct B : C {
  A a;
  constexpr B() {}
};

struct D : B { };

static constexpr A a;
static constexpr B b;
static constexpr D d;
```

Confirmed.


More information about the Gcc-bugs mailing list