Blame SOURCES/gcc48-pr77375.patch

56d343
2017-05-30  Jakub Jelinek  <jakub@redhat.com>
56d343
 
56d343
 	Backported from mainline
56d343
	2016-09-16  Jakub Jelinek  <jakub@redhat.com>
56d343
56d343
	PR c++/77375
56d343
	* class.c (check_bases): Set CLASSTYPE_HAS_MUTABLE if any
56d343
	TYPE_HAS_MUTABLE_P for any bases.
56d343
56d343
	* g++.dg/cpp0x/mutable1.C: New test.
56d343
56d343
--- gcc/cp/class.c	2017-10-17 17:27:32.287980595 +0200
56d343
+++ gcc/cp/class.c	2017-10-17 17:29:11.104213281 +0200
56d343
@@ -1479,6 +1479,8 @@ check_bases (tree t,
56d343
 	|= CLASSTYPE_CONTAINS_EMPTY_CLASS_P (basetype);
56d343
       TYPE_HAS_COMPLEX_DFLT (t) |= (!TYPE_HAS_DEFAULT_CONSTRUCTOR (basetype)
56d343
 				    || TYPE_HAS_COMPLEX_DFLT (basetype));
56d343
+      if (TYPE_HAS_MUTABLE_P (basetype))
56d343
+	CLASSTYPE_HAS_MUTABLE (t) = 1;
56d343
 
56d343
       /*  A standard-layout class is a class that:
56d343
 	  ...
56d343
--- /dev/null
56d343
+++ gcc/testsuite/g++.dg/cpp0x/mutable1.C
56d343
@@ -0,0 +1,12 @@
56d343
+// PR c++/77375
56d343
+// { dg-do run { target c++11 } }
56d343
+
56d343
+struct Base { mutable int i; };
56d343
+struct Derived : Base {};
56d343
+const Derived foo{};
56d343
+
56d343
+int
56d343
+main ()
56d343
+{
56d343
+  foo.i = 42;
56d343
+}