This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
anonymous union member is not hidden by gcc 2.95.2
- To: gcc-bugs at gcc dot gnu dot org
- Subject: anonymous union member is not hidden by gcc 2.95.2
- From: GerhardTonn at gmx dot de
- Date: Sat, 15 Jan 2000 13:47:20 +0100 (MET)
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