diff options
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/class.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/mutable1.C | 12 |
4 files changed, 31 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 070ea7ed2b3..1ce7773cf6d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2016-12-07 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-09-16 Jakub Jelinek <jakub@redhat.com> + + PR c++/77375 + * class.c (check_bases): Set CLASSTYPE_HAS_MUTABLE if any + TYPE_HAS_MUTABLE_P for any bases. + 2016-12-06 Jason Merrill <jason@redhat.com> PR c++/71274 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 3b4874a2c04..35deb1e99cd 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1777,6 +1777,8 @@ check_bases (tree t, SET_CLASSTYPE_REF_FIELDS_NEED_INIT (t, CLASSTYPE_REF_FIELDS_NEED_INIT (t) | CLASSTYPE_REF_FIELDS_NEED_INIT (basetype)); + if (TYPE_HAS_MUTABLE_P (basetype)) + CLASSTYPE_HAS_MUTABLE (t) = 1; /* A standard-layout class is a class that: ... diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c0737dad347..f077d2d6414 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2016-12-07 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2016-09-16 Jakub Jelinek <jakub@redhat.com> + + PR c++/77375 + * g++.dg/cpp0x/mutable1.C: New test. + 2016-12-07 Thomas Preud'homme <thomas.preudhomme@arm.com> Backport from mainline diff --git a/gcc/testsuite/g++.dg/cpp0x/mutable1.C b/gcc/testsuite/g++.dg/cpp0x/mutable1.C new file mode 100644 index 00000000000..4dd37185d72 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/mutable1.C @@ -0,0 +1,12 @@ +// PR c++/77375 +// { dg-do run { target c++11 } } + +struct Base { mutable int i; }; +struct Derived : Base {}; +const Derived foo{}; + +int +main () +{ + foo.i = 42; +} |