Index: cp/decl.c =================================================================== --- cp/decl.c (revision 167817) +++ cp/decl.c (working copy) @@ -9210,6 +9210,12 @@ grokdeclarator (const cp_declarator *dec error ("const %qs cannot be declared %", name); storage_class = sc_none; } + else if (TREE_CODE (type) == REFERENCE_TYPE) + { + permerror (input_location, "reference %qs cannot be declared " + "%", name); + storage_class = sc_none; + } } /* If this is declaring a typedef name, return a TYPE_DECL. */ Index: testsuite/g++.dg/other/pr33558.C =================================================================== --- testsuite/g++.dg/other/pr33558.C (revision 0) +++ testsuite/g++.dg/other/pr33558.C (revision 0) @@ -0,0 +1,5 @@ +/* { dg-do compile } */ + +class X { + mutable int &q; /* { dg-error "cannot be declared 'mutable'" } */ +}; Index: testsuite/g++.dg/other/pr33558-2.C =================================================================== --- testsuite/g++.dg/other/pr33558-2.C (revision 0) +++ testsuite/g++.dg/other/pr33558-2.C (revision 0) @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-fpermissive" } */ + +class X { + mutable int &q; /* { dg-warning "cannot be declared 'mutable'" } */ +};