Blame SOURCES/gcc48-pr77375.patch

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