klotz@parc.xerox.com (09/14/89)
In g++ 1.36.0- the attached programs gives the following error:
In function int main ():
mu.cc:24: request for member `a' is ambiguous
when in fact, the reference to the member is properly qualified.
No output file is produced.
Casting the object to (top_left) or (top_right) or (top) works,
and produces an output file, but generates the apparently spurious error message
In function int main ():
mu.cc:24: warning: assignment to virtual aggregate type
#include <stdio.h>
struct top {
int a = 0;
virtual int report() { return a; };
};
struct top_left : public top {
int a = 1;
};
struct top_right : public top {
int a = 2;
};
struct bottom : public top_left, public top_right {
int b;
};
main()
{
bottom x;
printf("%d\n", x.a);
}tom@tnosoes.UUCP (Tom Vijlbrief) (09/14/89)
>main() >{ > bottom x; > > printf("%d\n", x.a); >} I think g++ is right in reporting that x.a is ambigious: printf("%d\n", x.bottom::top_right::a); works as expected. printf("%d\n", x.top_right::a); does however not work. I'm not so familair with MI so I'm not sure this is a bug. Tom =============================================================================== Tom Vijlbrief TNO Institute for Perception P.O. Box 23 Phone: +31 34 63 562 11 3769 ZG Soesterberg E-mail: tnosoes!tom@mcvax.cwi.nl The Netherlands or: uunet!mcvax!tnosoes!tom ===============================================================================