/cp
2013-08-22 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56380
* class.c (check_field_decls): Check for const mutable and const
reference data members.
/testsuite
2013-08-22 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56380
* g++.dg/template/error54.C: New.
From-SVN: r201925
+2013-08-22 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/56380
+ * class.c (check_field_decls): Check for const mutable and const
+ reference data members.
+
2013-08-22 Gabriel Dos Reis <gdr@integrable-solutions.net>
* error.c (init_error): Remove calls to pp_construct and
if (DECL_MUTABLE_P (x) || TYPE_HAS_MUTABLE_P (type))
CLASSTYPE_HAS_MUTABLE (t) = 1;
+ if (DECL_MUTABLE_P (x))
+ {
+ if (CP_TYPE_CONST_P (type))
+ {
+ error ("member %q+D cannot be declared both %<const%> "
+ "and %<mutable%>", x);
+ continue;
+ }
+ if (TREE_CODE (type) == REFERENCE_TYPE)
+ {
+ error ("member %q+D cannot be declared as a %<mutable%> "
+ "reference", x);
+ continue;
+ }
+ }
+
if (! layout_pod_type_p (type))
/* DR 148 now allows pointers to members (which are POD themselves),
to be allowed in POD structs. */
+2013-08-22 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/56380
+ * g++.dg/template/error54.C: New.
+
2013-08-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/58185
--- /dev/null
+// PR c++/56380
+
+template <typename T>
+struct X {
+ X();
+ mutable T x; // { dg-error "cannot be declared" }
+};
+
+X<const int> a; // { dg-message "required from here" }
+X<int&> b; // { dg-message "required from here" }