re PR c++/7584 (Erroneous ambiguous base error on using declaration)
authorMark Mitchell <mark@codesourcery.com>
Thu, 17 Oct 2002 22:35:49 +0000 (22:35 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 17 Oct 2002 22:35:49 +0000 (22:35 +0000)
PR c++/7584
* class.c (handle_using_decl): Allow the declaration used to be
from an ambiguous base.

PR c++/7584
* g++.dg/inherit/using3.C: New test.

From-SVN: r58262

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/inherit/using3.C [new file with mode: 0644]

index 4f0b230a9628a18228fe09de616f5a7687968da3..b6836eef407e720b75782ed679cb86e3ad51e49f 100644 (file)
@@ -1,5 +1,9 @@
 2002-10-17  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/7584
+       * class.c (handle_using_decl): Allow the declaration used to be
+       from an ambiguous base.
+
        * pt.c (convert_template_argument): Revert this change:
                2002-10-16  Mark Mitchell  <mark@codesourcery.com>
                * pt.c (convert_template_argument): Do not fold non-type
index 59f5ce37fc1201fa01da3c5cf888813ec5eef0d4..90d7ef2c92180b9e99c70c2dcdd77b8dea7e722f 100644 (file)
@@ -1155,9 +1155,12 @@ handle_using_decl (using_decl, t)
   tree flist = NULL_TREE;
   tree old_value;
 
-  binfo = binfo_or_else (ctype, t);
+  binfo = lookup_base (t, ctype, ba_any, NULL);
   if (! binfo)
-    return;
+    {
+      error_not_base_type (t, ctype);
+      return;
+    }
   
   if (constructor_name_p (name, ctype))
     {
index 09ea6636ff63d3c7dc401e63c6ae158513ba2e2b..89befc5692b12f229b580d42d2f6f4cc0c569e8b 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-17  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/7584
+       * g++.dg/inherit/using3.C: New test.
+
 Thu Oct 17 19:12:58 CEST 2002  Jan Hubicka  <jh@suse.cz>
 
        * gcc.dg/20021017-2.c: New test.
diff --git a/gcc/testsuite/g++.dg/inherit/using3.C b/gcc/testsuite/g++.dg/inherit/using3.C
new file mode 100644 (file)
index 0000000..d2acf80
--- /dev/null
@@ -0,0 +1,19 @@
+class A
+{
+public:
+    typedef int T;
+    int a;
+};
+
+class B : virtual private A
+{
+};
+
+class C : virtual private A, public B
+{
+public:
+    using A::a;
+    using A::T;
+};
+
+C::T x;