This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
C++ BUG: Missed ambiguity
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: C++ BUG: Missed ambiguity
- From: Nathan Sidwell <nathan at acm dot org>
- Date: Wed, 01 Sep 1999 10:13:17 +0100
- Reply-To: nathan at compsci dot bristol dot ac dot uk
Hi,
the attached program contains 4 ambiguous accesses of a base class. The
current CVS tree fails to spot one of them
nathan50.C: In function `int fn(D0 *, D1 *, D2 *, D3 *)':
nathan50.C:15: type `A' is ambiguous base class for type `D1'
nathan50.C:16: type `A' is ambiguous base class for type `D2'
nathan50.C:17: type `A' is ambiguous base class for type `D3'
the missing ambiguity is in D0, where both B and C are virtual and each
contain a non-virtual A. so there are two distinct A bases.
shall I install the test case?
nathan
--
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
I have seen the death of PhotoShop -- it is called GIMP
nathan@acm.org http://www.cs.bris.ac.uk/~nathan/ nathan@cs.bris.ac.uk
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
struct A {int m;};
struct B : A { int m; };
struct C : A { int m; };
struct D0 : virtual B, virtual C { int m; };
struct D1 : virtual B, C { int m; };
struct D2 : B, virtual C { int m; };
struct D3 : B, C { int m; };
int fn(D0 *d0, D1 *d1, D2 *d2, D3 *d3)
{
A *a0 = d0; // ERROR - A is an ambiguous base
A *a1 = d1; // ERROR - A is an ambiguous base
A *a2 = d2; // ERROR - A is an ambiguous base
A *a3 = d3; // ERROR - A is an ambiguous base
}