🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Ron Guilmette Sat, 11 Mar 1989 01:37
BUG in G++ 1.34.0 - bogus error
#1725
Author: Ron Guilmette
Date: Sat, 11 Mar 1989 01:37
25 lines
1377 bytes
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


// Ron Guilmette  -  MCC  -  Experimental (parallel) Systems Kit Project
// 3500 West Balcones Center Drive,  Austin, TX  78759  -  (512)338-3740
// ARPA: rfg@mcc.com
// UUCP: {rutgers,uunet,gatech,ames,pyramid}!cs.utexas.edu!pp!rfg
Re: BUG in G++ 1.34.0 - bogus error
#1712
Author: Doug Schmidt
Date: Sat, 11 Mar 1989 05:26
40 lines
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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads