https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94074
--- Comment #2 from Marek Polacek ---
And this should be diagnosed but isn't:
struct X {
int i;
};
template
struct S {
const X x;
constexpr S(int) : x{}
{
const_cast(x).i = 19; // { dg-error "modifying a const object" }
}
};
con
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94074
--- Comment #2 from Marek Polacek ---
And this should be diagnosed but isn't:
struct X {
int i;
};
template
struct S {
const X x;
constexpr S(int) : x{}
{
const_cast(x).i = 19; // { dg-error "modifying a const object" }
}
};
con
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94074
Marek Polacek changed:
What|Removed |Added
Keywords||rejects-valid
Priority|P3