Date: Wed, 13 Sep 2000 17:10:10 -0700 (PDT) From: Archie Cobbs <archie@whistle.com> To: John Polstra <jdp@polstra.com> Cc: hackers@freebsd.org Subject: Re: c++ error Message-ID: <200009140010.RAA04731@bubba.whistle.com> In-Reply-To: <200009132358.QAA01085@vashon.polstra.com> "from John Polstra at Sep 13, 2000 04:58:53 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
John Polstra writes: > > This happens on 4.1-RELEASE: > > > > $ c++ ... foo.cc > > > > /usr/include/netinet/in.h:303: ANSI C++ forbids data member `ip_opts' with same name as enclosing class > > *** Error code 1 > > > > Any ideas? I tried __BEGIN_DECLS and __END_DECLS but that didn't help. > > I'm not a C++ expert. > > > > $ c++ --version > > $ 2.95.2 > > I can't duplicate it with this "program": > > #include <sys/types.h> > #include <netinet/in.h> > > I compile it with "cc -c test.cc" and get no errors. The diagnostic Same here. > is valid, but there is a kludge in the compiler to make it work > anyway. See "src/contrib/gcc.295/cp/decl.c" around line 11515: > > /* 9.2p13 [class.mem] */ > if (declarator == constructor_name (current_class_type) > /* Divergence from the standard: In extern "C", we > allow non-static data members here, because C does > and /usr/include/netinet/in.h uses that. */ > && (staticp || ! in_system_header)) > cp_pedwarn ("ANSI C++ forbids data member `%D' with same name as enclosing class", > declarator); That is a kludge if I ever saw one!! > Notice that it is permissive if the declaration is in a "system > header". This seems to work right, because if I create a local > directory "netinet" containing a copy of "in.h" and add "-I." to the > command line, then I get the diagnostic. > > Is this the standard compiler installation, or are you using the ports > version? If it's the ports version, maybe it has an incorrect notion > of where the system headers are. I ran my tests using the standard > FreeBSD compiler installation. This is the standard compiler in 4.1. However, the particular source files being compiled are messy and it wouldn't surprise me that they are triggering something. On the other hand, nothing in the kernel actually uses "struct ip_opts", though I haven't checked all of userland.. so we may just be able to remove it. -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009140010.RAA04731>