[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
<netinet/in.h> - ANSI C++ forbids data member `ip_opts' with same name
From: |
Rocha Iran-QIR001 |
Subject: |
<netinet/in.h> - ANSI C++ forbids data member `ip_opts' with same name as enclosing class |
Date: |
Thu, 11 Apr 2002 16:26:40 -0500 |
I read in the Red Hat web site that the include file netinet/in.h comes
with the glibc. I had originally sent this bug to the GCC mailing list
but now I've decided to ask you guys for help. Would you happen to know
if this is a bug? I've read in some web sites people suggesting to change
the include file to fix the problem but I do not like the idea of changing
a include file unless it is coming from a good source. Any help would
be appreciated.
Thanks,
Iran Rocha
===========================================================================
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- <netinet/in.h> - ANSI C++ forbids data member `ip_opts' with same name as enclosing class,
Rocha Iran-QIR001 <=