This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/5958: Multiple calls to destructor of local objects, inside a for-loop
- From: smadhavan at inautix dot com
- To: gcc-gnats at gcc dot gnu dot org
- Cc: vatsan at vsnl dot com
- Date: 14 Mar 2002 06:02:15 -0000
- Subject: c++/5958: Multiple calls to destructor of local objects, inside a for-loop
- Reply-to: smadhavan at inautix dot com
>Number: 5958
>Category: c++
>Synopsis: Multiple calls to destructor of local objects, inside a for-loop
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Mar 13 22:06:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Srivathsan Madhavan
>Release: GCC ver. 3.0.3
>Organization:
>Environment:
Cygwin 1.3.9-1, Windows NT 4 SP6a, Intel PIII
>Description:
An extra call(s) to the destructor is made during object destruction of local objects (inside the loop). This could be understood by compiling and executing the C++ Program attached. The behaviour of the executable (created by g++) was compared with that created by Borlad C++ ver. 5.5.1 (bcc32) for Win32. I feel what the Borland Compiler is doing is right.
>How-To-Repeat:
Just compile the attached source code file with G++ and Borland's bcc32 (ver. 5.5.1). Execute the 2 EXEs and you will see the difference. For convenience I have given the outputs of the 2 EXEs in a comment block at the end of the source code.
>Fix:
-?-
>Release-Note:
>Audit-Trail:
>Unformatted: