From owner-freebsd-hackers Wed Sep 13 17:10:57 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from whistle.com (s205m131.whistle.com [207.76.205.131]) by hub.freebsd.org (Postfix) with ESMTP id 94F3637B424 for ; Wed, 13 Sep 2000 17:10:54 -0700 (PDT) Received: (from smap@localhost) by whistle.com (8.10.0/8.10.0) id e8E0ACe09682; Wed, 13 Sep 2000 17:10:12 -0700 (PDT) Received: from bubba.whistle.com( 207.76.205.7) by whistle.com via smap (V2.0) id xma009680; Wed, 13 Sep 2000 17:10:10 -0700 Received: (from archie@localhost) by bubba.whistle.com (8.9.3/8.9.3) id RAA04731; Wed, 13 Sep 2000 17:10:10 -0700 (PDT) (envelope-from archie) From: Archie Cobbs Message-Id: <200009140010.RAA04731@bubba.whistle.com> Subject: Re: c++ error In-Reply-To: <200009132358.QAA01085@vashon.polstra.com> "from John Polstra at Sep 13, 2000 04:58:53 pm" To: John Polstra Date: Wed, 13 Sep 2000 17:10:10 -0700 (PDT) Cc: hackers@freebsd.org X-Mailer: ELM [version 2.4ME+ PL82 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 > #include > > 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