Bug 7584 - Erroneous ambiguous base error on using declaration
Summary: Erroneous ambiguous base error on using declaration
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.1.1
: P3 normal
Target Milestone: ---
Assignee: Mark Mitchell
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2002-08-13 07:06 UTC by Tim Bagot
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Bagot 2002-08-13 07:06:01 UTC
When compiling the code below, gcc reports "`A' is an ambiguous base of `C'" for each using declaration, and goes on to complain of "C::T x;" that "`typedef int A::T' is inaccessible". (Incidentally, the ambiguous base messages give the line number of the opening brace of the class definition.) There is no ambiguity for either using declaration, since A is a virtual base class. In the second, there would be no ambiguity even if A were a non-virtual base, since nested types can always be referred to unambiguously (para. 10.2/5).

Release:
3.1.1  (powerpc-eabi)

Environment:
Debian GNU/Linux x86 unstable

How-To-Repeat:
Compile the following with gcc -c

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;
Comment 2 Nathan Sidwell 2002-09-13 16:03:31 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: confirmed as a regression
Comment 3 Mark Mitchell 2002-10-17 13:40:54 UTC
Responsible-Changed-From-To: unassigned->mmitchel
Responsible-Changed-Why: Working on a fix.
Comment 4 Mark Mitchell 2002-10-17 15:38:17 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in GCC 3.2.1.
Comment 5 Mark Mitchell 2002-10-17 22:35:50 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7584
Date: 17 Oct 2002 22:35:50 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2002-10-17 15:35:50
 
 Modified files:
 	gcc/cp         : ChangeLog class.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/inherit: using3.C 
 
 Log message:
 	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.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3007&r2=1.3008
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.475&r2=1.476
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2155&r2=1.2156
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/using3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 6 Mark Mitchell 2002-10-17 22:35:50 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7584
Date: 17 Oct 2002 22:35:50 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2002-10-17 15:35:50
 
 Modified files:
 	gcc/cp         : ChangeLog class.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/inherit: using3.C 
 
 Log message:
 	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.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3007&r2=1.3008
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.475&r2=1.476
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2155&r2=1.2156
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/using3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 
Comment 7 Mark Mitchell 2002-10-17 22:37:49 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7584
Date: 17 Oct 2002 22:37:49 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	mmitchel@gcc.gnu.org	2002-10-17 15:37:49
 
 Modified files:
 	gcc/cp         : ChangeLog class.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/inherit: using3.C 
 
 Log message:
 	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.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.23&r2=1.2685.2.114.2.24
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.436.2.10.2.4&r2=1.436.2.10.2.5
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.31&r2=1.1672.2.166.2.32
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/using3.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1
 

Comment 8 Mark Mitchell 2002-10-17 22:37:49 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/7584
Date: 17 Oct 2002 22:37:49 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	mmitchel@gcc.gnu.org	2002-10-17 15:37:49
 
 Modified files:
 	gcc/cp         : ChangeLog class.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/inherit: using3.C 
 
 Log message:
 	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.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.23&r2=1.2685.2.114.2.24
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.436.2.10.2.4&r2=1.436.2.10.2.5
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.31&r2=1.1672.2.166.2.32
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/using3.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1