http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54026

--- Comment #2 from Paul Pluzhnikov <ppluzhnikov at google dot com> 2012-07-19 
13:20:40 UTC ---
(In reply to comment #1)
> I don't think 'mutable' overrides a const declaration specifier.

I am not a language lawyer, but I believe the standard disagrees: from
INCITS+ISO+IEC+14882-2011-DRAFT.pdf (similar language in
INCITS+ISO+IEC+14882-1998.pdf):


3.10 Lvalues and rvalues
...
8 The referent of a const-qualified expression shall not be modified (through
that expression), except that if it is of class type and has a mutable
component, that component can be modified (7.1.6.1).


7.1.6.1 The cv-qualifiers
...
5 For another example

  struct X {
    mutable int i;
    int j;
  };

  struct Y {
    X x;
    Y();
  };

  const Y y;
  y.x.i++; // well-formed: mutable member can be modified

Reply via email to