egcs-970917: Misleading error message

Eric Hennemann cardan@midgard.han.de
Wed Sep 17 19:40:00 GMT 1997


Hello,

when compiling the following piece of code

--- chainsaw ---

#include <iostream>

template < class T >
class X
{
  protected:

    union {
    	int	x;
    	double	y;
    };
};

template < class T >
class Y : public X<T>
{
  public:

    using X<T>::x;

    void	f () { cout << x << endl; }
};

--- chainsaw ---

the egcs c++-compiler gives the error message:

hel:~$ eg++ -o asdf.o -c asdf.cc
asdf.cc: In method `void Y<T>::f()':
asdf.cc:22: request for member `x' is ambiguous in multiple inheritance lattice

I am not sure if a using declaration may refer to a member of an anonymous union.
However, there is no multiple inheritance involved.  (The code compiles for non-
template classes or with the using decl removed.)

hel:~$ eg++ --version
egcs-2.90.08 970917 (gcc2-970802 experimental)

FWIW, my system setup is

	i486-pc-linux-gnulibc1
	Linux-2.1.55
	libc-5.4.17

configure was given the options '--prefix=/opt/EGCS --enable-shared'.

	Eric
-- 
	Eric Hennemann		dog, n.: A kind of additional or subsidiary
	cardan@midgard.han.de	Deity designed to catch the overflow and
				surplus of the world's worship.
				 -- Bierce, "The Enlarged Devil's Dictionary"



More information about the Gcc-bugs mailing list