7.1.1/8 says that 'mutable' can't be applied to reference members: The mutable specifier can be applied only to names of class data members (_class.mem_) and cannot be applied to names declared const or static, and cannot be applied to reference members. Yet gcc accepts this code: ---------------- class X { mutable int &q; }; ---------------- This would seem to be in error. W.
Confirmed.
Created attachment 19523 [details] patch
http://gcc.gnu.org/ml/gcc-patches/2010-01/msg00420.html -- Giovanni
new patch http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01469.html
Author: redi Date: Sat Jan 15 14:41:09 2011 New Revision: 168843 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168843 Log: 2011-01-15 Giovanni Funchal <gafunchal@gmail.com> Jonathan Wakely <jwakely.gcc@gmail.com> PR c++/33558 * decl.c (grokdeclarator): Reject mutable reference members. Added: trunk/gcc/testsuite/g++.dg/other/pr33558-2.C trunk/gcc/testsuite/g++.dg/other/pr33558.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/testsuite/ChangeLog
Patch approved by Jason at http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00918.html Fixed for 4.6.0