A bug in member name lookup?

Dan Glastonbury Dan.Glastonbury@adelaide.maptek.com.au
Sun Sep 27 21:15:00 GMT 1998


G'Day,
  Apologies if this is already a known problem.

Compiling the following code that comes from paragraph 6 of 
[class.member.lookup] in CD2:
class V { public: int f();  int x; };
class W { public: int g();  int y; };
class B : public virtual V, public W
{
public:
  int f();  int x;
  int g();  int y;
};
class C : public virtual V, public W { };
class D : public B, public C { void glorp(); };

void D::glorp()
{
  x++;        // ok: B::x hides V::x
  f();        // ok: B::f() hides V::f()
  y++;        // error: B::y and C's W::y
  g();        // error: B::g() and C's W::g()
}

produces the following error messages:
testing.c++: In method `void D::glorp()':
testing.c++:14: request for member `x' is ambiguous in multiple inheritance 
lattice
testing.c++:16: request for member `y' is ambiguous in multiple inheritance 
lattice
testing.c++:17: request for method `g' is ambiguous

>From what I can understand of the draft standard.  Line 14 shouldn't be an 
error.

I'm using the 1.1b version of egcs:
Reading specs from /usr/freeware/lib/gcc-lib/mips-sgi-irix6.3/egcs-2.91.57/spe
cs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)

cheers
Dan

-- 
Dan Glastonbury  <Dan.Glastonbury at maptek.com.au>  `Network is unreachabl'





More information about the Gcc-bugs mailing list