Bug 16891 - Ambiguity ??
Summary: Ambiguity ??
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-06 01:57 UTC by Ivan Godard
Modified: 2005-07-23 22:49 UTC (History)
1 user (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 Ivan Godard 2004-08-06 01:57:58 UTC
class B1 {
    void Foo() {}
    };
struct B2 {
    void Foo() {}
    }
struct D : public B1, public B2 {
    void Bar() { Foo(); }
    };
int main() {
    D d;
    return 0;
}

gets you:


foo.cc: In member function `void D::Bar()':
foo.cc:8: error: reference to `Foo' is ambiguous
foo.cc:5: error: candidates are: void B2::Foo()
foo.cc:2: error:                 void B1::Foo()
foo.cc:8: error: `Foo' undeclared (first use this function)
foo.cc:8: error: (Each undeclared identifier is reported only once for each function it appears in.)
foo.cc: At global scope:
foo.cc:9: error: multiple types in one declaration


However, only one of the Foo's is visible. Where's the ambiguity?

Ivan
Comment 1 Andrew Pinski 2004-08-06 02:18:17 UTC
No the error is correct, it does not matter if the function is accessible or not for name lookup.  
Accessible checking comes after name lookup.
Comment 2 CVS Commits 2004-12-23 16:09:17 UTC
Subject: Bug 16891

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	aoliva@gcc.gnu.org	2004-12-23 16:09:01

Modified files:
	gcc            : ChangeLog calls.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: empty2.c 

Log message:
	gcc/ChangeLog:
	PR target/16819
	* calls.c (load_register_parameters): Don't call use_regs when
	nregs is zero.
	gcc/testsuite/ChangeLog:
	PR target/16891
	* gcc.dg/empty2.c: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6943&r2=2.6944
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/calls.c.diff?cvsroot=gcc&r1=1.373&r2=1.374
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4803&r2=1.4804
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/empty2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1