anonymous union member is not hidden by gcc 2.95.2

GerhardTonn@gmx.de GerhardTonn@gmx.de
Sat Jan 15 04:47:00 GMT 2000


Compiling the following code fragment by g++ :

class super 
{
public:
private:
union{
  int myName;
  void * secondMember;
};
};
class sub : public super
{
public:
int myName() {return 1;}
};

int
main(int argc, char ** argv)
{
sub myObject;
myObject.myName();
}

results in
tst.cxx:13: declaration of `int sub::myName()'
tst.cxx:6: conflicts with previous declaration `int super::{anonymous
union}::myName'

which in my opinion is wrong, since the member should be hidden.

Gerhard

-- 
Sent through Global Message Exchange - http://www.gmx.net



More information about the Gcc-bugs mailing list