Article View: gnu.g++.bug
Article #1729BUG in G++ 1.34.0 - missed error
From: Ron Guilmette
Date: Sun, 12 Mar 1989 19:21
Date: Sun, 12 Mar 1989 19:21
36 lines
1392 bytes
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
Technical Details
Message-ID:
<8903121921.AA12454@riunite.aca.mcc.com>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!MCC.COM!rfgShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!MCC.COM!rfg From: rfg@MCC.COM (Ron Guilmette) Newsgroups: gnu.g++.bug Subject: BUG in G++ 1.34.0 - missed error Message-ID: <8903121921.AA12454@riunite.aca.mcc.com> Date: 12 Mar 89 19:21:01 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 36