This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

anonymous union member is not hidden by gcc 2.95.2


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]