Article View: gnu.g++.bug
Article #1712Re: BUG in G++ 1.34.0 - bogus error
From: Doug Schmidt
Date: Sat, 11 Mar 1989 05:26
Date: Sat, 11 Mar 1989 05:26
40 lines
2240 bytes
2240 bytes
In article <8903110137.AA08978@riunite.aca.mcc.com> rfg@MCC.COM (Ron Guilmette) writes:
++ The following code gets an error using G++ 1.34.0/Sun3. It shouldn't.
++
++ Cut here
++ ------------------------------------------------------------------------
++ /*
++ Description - The c++ "manual" (p. 270) says that "... a declaration may add
++ default arguments not given in previous declarations" This
++ privledge should probably extend to method declarations and
++ function declarations alike. The following code checks that
++ a re-declaration of a method may add some new defaults.
++ */
++
++ struct class1 {
++ void method1 (int arg1, int arg2);
++ void method1 (int arg1, int arg2 = 35);
++ };
++ ---------------------------------------------------------------------------
++ g++ -S x06.cc
++ x06.cc:11: `void class1::method1 (int, int (= 35 ))' is already defined in aggregate scope
I'm not sure if G++ is wrong here. Here's what cfront 1.2.1 sez:
----------------------------------------
CC bug.c:
"bug.c", line 12: error: two declarations of class1::method1()
sorry, cannot recover from previous error
1 error
----------------------------------------
This error certainly makes intuitive sense, although I can see how one
might come to the other interpretation from the ``manual.'' I guess
we'll just have to wait for 2.0 and the new C++ reference...
Doug
--
schmidt@ics.uci.edu (ARPA) | Per me si va nella citta' dolente.
office: (714) 856-4043 | Per me si va nell'eterno dolore.
| Per me si va tra la perduta gente.
| Lasciate ogni speranza o voi ch'entrate.
Technical Details
Message-ID:
<8996@paris.ics.uci.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!ucbvax!ucsd!orion.cf.uci.edu!uci-ics!crimee.ics.uci.edu!schmidtReferences:
<8903110137.AA08978@riunite.aca.mcc.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!ucbvax!ucsd!orion.cf.uci.edu!uci-ics!crimee.ics.uci.edu!schmidt From: schmidt@crimee.ics.uci.edu (Doug Schmidt) Newsgroups: gnu.g++.bug Subject: Re: BUG in G++ 1.34.0 - bogus error Message-ID: <8996@paris.ics.uci.edu> Date: 11 Mar 89 05:26:05 GMT References: <8903110137.AA08978@riunite.aca.mcc.com> Sender: news@paris.ics.uci.edu Reply-To: Doug Schmidt <schmidt@crimee.ics.uci.edu> Distribution: gnu Organization: University of California at Irvine: ICS Dept. Lines: 40