Patchwork [C++,committed] PR 48798

login
register
mail settings
Submitter Paolo Carlini
Date April 28, 2011, 6:14 p.m.
Message ID <4DB9AE9B.70200@oracle.com>
Download mbox | patch
Permalink /patch/93272/
State New
Headers show

Comments

Paolo Carlini - April 28, 2011, 6:14 p.m.
Hi,

I committed the below patchlet, per the exchange with Jason on the audit 
trail, after having regtested it on x86_64-linux.

Thanks,
Paolo.

////////////////////
/cp
2011-04-28  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/48798
	* semantics.c (finish_base_specifier): cv-qualified base class
	is fine, per DR 484.

/testsuite
2011-04-28  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/48798
	* g++.dg/inherit/pr48798.C: New.
	* g++.old-deja/g++.other/base1.C: Adjust.

Patch

Index: testsuite/g++.old-deja/g++.other/base1.C
===================================================================
--- testsuite/g++.old-deja/g++.other/base1.C	(revision 173116)
+++ testsuite/g++.old-deja/g++.other/base1.C	(working copy)
@@ -3,8 +3,7 @@ 
 // Copyright (C) 2000 Free Software Foundation, Inc.
 // Contributed by Nathan Sidwell 25 Nov 2000 <nathan@codesourcery.com>
 
-// 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 {};
Index: testsuite/g++.dg/inherit/pr48798.C
===================================================================
--- testsuite/g++.dg/inherit/pr48798.C	(revision 0)
+++ testsuite/g++.dg/inherit/pr48798.C	(revision 0)
@@ -0,0 +1,4 @@ 
+// PR c++/48798
+
+typedef struct A {} const t;
+struct B : t {};
Index: cp/semantics.c
===================================================================
--- cp/semantics.c	(revision 173116)
+++ cp/semantics.c	(working copy)
@@ -2766,7 +2766,8 @@  finish_base_specifier (tree base, tree access, boo
     {
       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);