🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Ron Guilmette Sat, 22 Apr 1989 16:00
BUG(s) in G++ 1.35.0 (pre-release)
#1889
Author: Ron Guilmette
Date: Sat, 22 Apr 1989 16:00
131 lines
4440 bytes
The following source file checks that it is always illegal to
specify the return type for a constructor or a destructor.

When compiled with G++ 1.35.0 (pre-release, Apr. 20th), it is
apparent that the compiler does (incorrectly) allow you to:

	a) specify the return type of a destructor as void, and
	b) specify the return type of a destructor as void*, and
	c) specify the return type of a constructor as class_name*,
	   where "class_name" is the name of the containing class.

I believe that (a), (b), and (c) should all causes errors.

Another thing to note (in the compile log shown below the code) is that
the errors and warnings which *are* issued for explicit return type
specifications on constructors/destructors are inconsistant.  Shouldn't
there be one single message like:

	illegal return type spec for constructor or destructor

which is issued for all such cases?

Here is a list of the missed errors in the code below:

b036 had missed error(s) as follows:
	18: 	void ~class1 ();	// ERROR
	28: 	void* ~class3 ();	// ERROR
	37: 	class5* class5 ();	// ERROR
	44: 	void ~class6 () {	// ERROR
	58: 	void* ~class8 () {	// ERROR
	70: 	class10* class10 () {	// ERROR

------------------------------------------------------------------------
// Check that it is illegal to specify a return type in a
// declaration or a definition of either a constructor or
// a destructor.
//
// Cases:
//	void type
//	int type
//	void* type
//	class type
//	class* type
//
//	declarations & definitions
//
//	constructors & destructors

struct class1 {
	void class1 ();		// ERROR
	void ~class1 ();	// ERROR
};

struct class2 {
	int class2 ();		// ERROR
	int ~class2 ();		// ERROR
};

struct class3 {
	void* class3 ();	// ERROR
	void* ~class3 ();	// ERROR
};

struct class4 {
	class4 class4 ();	// ERROR
	class4 ~class4 ();	// ERROR
};

struct class5 {
	class5* class5 ();	// ERROR
	class5* ~class5 ();	// ERROR
};

struct class6 {
	void class6 () {	// ERROR
	};
	void ~class6 () {	// ERROR
	};
};

struct class7 {
	int class7 () {		// ERROR
	};
	int ~class7 () {	// ERROR
	};
};

struct class8 {
	void* class8 () {	// ERROR
	};
	void* ~class8 () {	// ERROR
	};
};

struct class9 {
	class9 class9 () {	// ERROR
	};
	class9 ~class9 () {	// ERROR
	};
};

struct class10 {
	class10* class10 () {	// ERROR
	};
	class10* ~class10 () {	// ERROR
	};
};
---------------------------------------------------------------------------
/usr/local/src/src/g++/build/sun3/1.35-.0-.0/g++ -B/usr/local/src/src/g++/build/sun3/1.35-.0-.0/ -Wall -Wwrite-strings -S -v b036.C
g++ version 1.35.0-
 /usr/local/src/src/g++/build/sun3/1.35-.0-.0/cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -Wall -D__HAVE_68881__ -Dmc68020 b036.C /tmp/cca15886.cpp
GNU CPP version 1.35.0-
 /usr/local/src/src/g++/build/sun3/1.35-.0-.0/c++ /tmp/cca15886.cpp -quiet -dumpbase b036.C -Wall -Wwrite-strings -noreg -version -o b036.s
GNU C++ version 1.35.0- (68k, MIT syntax) compiled by GNU C version 1.34.1.
b036.C:17: invalid return type given for constructor
b036.C:22: invalid return type given for constructor
b036.C:23: non-void return type specified for destructor
b036.C:27: constructor declared with invalid return type
b036.C:32: invalid return type given for constructor
b036.C:33: non-void return type specified for destructor
b036.C:37: warning: declaration of return type for constructor redundant
b036.C:38: non-void return type specified for destructor
b036.C:42: invalid return type given for constructor
b036.C:49: invalid return type given for constructor
b036.C:51: non-void return type specified for destructor
b036.C:56: constructor declared with invalid return type
b036.C:63: invalid return type given for constructor
b036.C:65: non-void return type specified for destructor
b036.C:70: warning: declaration of return type for constructor redundant
b036.C:72: non-void return type specified for destructor
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