Commit 546a4197 by Paolo Carlini Committed by Paolo Carlini

re PR c++/48798 (CV-qualified base class erroneously forbidden)

/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.

From-SVN: r173124
parent f62cd409
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.
2011-04-28 Dodji Seketeli <dodji@redhat.com> 2011-04-28 Dodji Seketeli <dodji@redhat.com>
PR c++/48656 PR c++/48656
......
...@@ -2767,7 +2767,8 @@ finish_base_specifier (tree base, tree access, bool virtual_p) ...@@ -2767,7 +2767,8 @@ finish_base_specifier (tree base, tree access, bool virtual_p)
{ {
if (cp_type_quals (base) != 0) 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); base = TYPE_MAIN_VARIANT (base);
} }
result = build_tree_list (access, base); result = build_tree_list (access, base);
......
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.
2011-04-28 Dodji Seketeli <dodji@redhat.com> 2011-04-28 Dodji Seketeli <dodji@redhat.com>
PR c++/48656 PR c++/48656
......
// PR c++/48798
typedef struct A {} const t;
struct B : t {};
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
// Copyright (C) 2000 Free Software Foundation, Inc. // Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 25 Nov 2000 <nathan@codesourcery.com> // Contributed by Nathan Sidwell 25 Nov 2000 <nathan@codesourcery.com>
// We lost information about which base wasn't an aggregate type, plus we // We lost information about which base wasn't an aggregate type.
// allowed cv qualifed bases via typedefs.
typedef int I; typedef int I;
typedef int cI; typedef int cI;
...@@ -16,5 +15,5 @@ typedef A pA; ...@@ -16,5 +15,5 @@ typedef A pA;
struct B : I {}; // { dg-error "" } not an aggregate struct B : I {}; // { dg-error "" } not an aggregate
struct C : cI {}; // { 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 {}; struct E : pA {};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment