[cfe-dev] clang issue with 'mutable' ?

Stefan Seefeld stefan at seefeld.name
Mon Oct 21 09:50:05 PDT 2013

On 2013-10-21 12:35, David Blaikie wrote:
> Interestingly GCC ToT (g++-tot (GCC) 4.9.0 20130829 (experimental))
> rejects this the same way Clang does, but 4.8.1 does not (it accepts it).

Interesting.  Unfortunately I still don't entirely understand why the
code is rejected. Is there any wording in the C++ spec that suggests
that the "wrapper" template may not be instantiated with some const type
? In my reading, a "mutable" member is simply a statement about it not
being part of the "logically const" state of the containing object,
which is entirely orthogonal to the question of whether the member
itself is immutable. Obviously combining "const" and "mutable" in a
single declaration is meaningless. But as in my code, both qualifiers
can still end up in the same spot through parametrization, which seems
entirely reasonable to me. Am I wrong ?

While I can think of some workarounds, I'd rather understand what the
issue is before making any attempt at working around it.

Many thanks,


      ...ich hab' noch einen Koffer in Berlin...

More information about the cfe-dev mailing list