From 546a41977ba5c1eacb17a73ef46f05a744056993 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 28 Apr 2011 18:12:29 +0000 Subject: [PATCH] re PR c++/48798 (CV-qualified base class erroneously forbidden) /cp 2011-04-28 Paolo Carlini PR c++/48798 * semantics.c (finish_base_specifier): cv-qualified base class is fine, per DR 484. /testsuite 2011-04-28 Paolo Carlini PR c++/48798 * g++.dg/inherit/pr48798.C: New. * g++.old-deja/g++.other/base1.C: Adjust. From-SVN: r173124 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/semantics.c | 3 ++- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/inherit/pr48798.C | 4 ++++ gcc/testsuite/g++.old-deja/g++.other/base1.C | 5 ++--- 5 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/inherit/pr48798.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6b6d81bd26e..e34f03f464f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-04-28 Paolo Carlini + + PR c++/48798 + * semantics.c (finish_base_specifier): cv-qualified base class + is fine, per DR 484. + 2011-04-28 Dodji Seketeli PR c++/48656 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 722e57fe528..815824a5b7a 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2767,7 +2767,8 @@ finish_base_specifier (tree base, tree access, bool virtual_p) { if (cp_type_quals (base) != 0) { - error ("base class %qT has cv qualifiers", base); + /* DR 484: Can a base-specifier name a cv-qualified + class type? */ base = TYPE_MAIN_VARIANT (base); } result = build_tree_list (access, base); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b0d5e1c6f6c..8d0d6a9da55 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-04-28 Paolo Carlini + + PR c++/48798 + * g++.dg/inherit/pr48798.C: New. + * g++.old-deja/g++.other/base1.C: Adjust. + 2011-04-28 Dodji Seketeli PR c++/48656 diff --git a/gcc/testsuite/g++.dg/inherit/pr48798.C b/gcc/testsuite/g++.dg/inherit/pr48798.C new file mode 100644 index 00000000000..cc9921e69b8 --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/pr48798.C @@ -0,0 +1,4 @@ +// PR c++/48798 + +typedef struct A {} const t; +struct B : t {}; diff --git a/gcc/testsuite/g++.old-deja/g++.other/base1.C b/gcc/testsuite/g++.old-deja/g++.other/base1.C index 3c9ac264e1d..b38a6546d03 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/base1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/base1.C @@ -3,8 +3,7 @@ // Copyright (C) 2000 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 25 Nov 2000 -// We lost information about which base wasn't an aggregate type, plus we -// allowed cv qualifed bases via typedefs. +// We lost information about which base wasn't an aggregate type. typedef int I; typedef int cI; @@ -16,5 +15,5 @@ typedef A pA; struct B : I {}; // { dg-error "" } not an aggregate struct C : cI {}; // { dg-error "" } not an aggregate -struct D : cA {}; // { dg-error "" } cv qualified +struct D : cA {}; // cv-qualified is fine per DR 484 struct E : pA {}; -- 2.30.2