re PR c++/48798 (CV-qualified base class erroneously forbidden)
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 28 Apr 2011 18:12:29 +0000 (18:12 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 28 Apr 2011 18:12:29 +0000 (18:12 +0000)
/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

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/inherit/pr48798.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.other/base1.C

index 6b6d81b..e34f03f 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        PR c++/48656
index 722e57f..815824a 100644 (file)
@@ -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);
index b0d5e1c..8d0d6a9 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        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 (file)
index 0000000..cc9921e
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/48798
+
+typedef struct A {} const t;
+struct B : t {};
index 3c9ac26..b38a654 100644 (file)
@@ -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 {};