🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Ron Guilmette Sun, 12 Mar 1989 19:21
BUG in G++ 1.34.0 - missed error
#1729
Author: Ron Guilmette
Date: Sun, 12 Mar 1989 19:21
36 lines
1392 bytes
When compiled with the G++ 1.34.0/Sun3 compiler, the following short
code gets no errors.  It should elicit a compile-time error on the
indicated line.  Note that an error *is* produced if the declaration
of "c_object_1" is removed from the code.

The fact that no error is issued causes further problems at run-time.
Specifically, execution of test() will result in two destructor calls,
but only one call to the constructor for the type "c".

/*
Description - check that "it is not possible to transfer control past a
		declaration with an (implicit or explicit) initializer"
		as called for by the "manual", section 9.11, page 296.
*/

class c {
public:
	c (int i);
	~c ();
};

void test ()
{
	c c_object_1(1);

	goto lbl;		// ERROR

	c c_object_2 (2);
lbl: ;
}


// 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
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