G++ 2.95.3 - ANSI C++ forbids data member `ip_opts' with same nam e as enclosing class
Rocha Iran-QIR001
Iran.Rocha@motorola.com
Wed Apr 10 07:30:00 GMT 2002
I have ran across a problem using GCC 2.95.3 as a cross-compiler. My code
fails to compile with g++ when I include
<netinet/in.h>. The error message is shown below:
ANSI C++ forbids data member `ip_opts' with same name as enclosing class
The compiler is apparently complaining about the char data member of the
following structure declared in bits/in.h:
/* Structure used to describe IP options for IP_OPTIONS. The `ip_dst'
field is used for the first-hop gateway when using a source route
(this gets put into the header proper). */
struct ip_opts
{
struct in_addr ip_dst; /* First hop; zero without source route. */
char ip_opts[40]; /* Actually variable in size. */
};
As the error message implies, this appears to be an ANSI C++ constrain only.
I was able to verify that by compiling
a similar sample code using gcc rather than g++. This appears to be a bug to
me and this is why I am posting it in
gcc-bugs rather than gcc-help. Is this the case? If yes, has this bug been
fixed in the latest release of GCC? If
it hasn't been fixed, is there a safe way to get around it? If this is not a
bug, would there be a good explanation
for this problem?
Thanks in advance,
Iran Rocha
More information about the Gcc-bugs
mailing list