[Bug c++/94074] bogus modifying a const object error with const COMPONENT_REF

2020-03-09 Thread mpolacek at gcc dot gnu.org
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

[Bug c++/94074] bogus modifying a const object error with const COMPONENT_REF

2020-03-06 Thread mpolacek at gcc dot gnu.org
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

[Bug c++/94074] bogus modifying a const object error with const COMPONENT_REF

2020-03-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94074 Marek Polacek changed: What|Removed |Added Keywords||rejects-valid Priority|P3