c++/3948: Two destructors are called when no copy destructor is defined
ksingh@oz.agile.tv
ksingh@oz.agile.tv
Sun Aug 5 21:06:00 GMT 2001
>Number: 3948
>Category: c++
>Synopsis: Two destructors are called when no copy destructor is defined
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Aug 05 21:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Kalvinder Singh
>Release: GCC-3.0
>Organization:
>Environment:
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ../configure
Thread model: single
gcc version 3.0
>Description:
Quote from Nathan Sidwell
in main, we copy construct two C objects during the call to Foo.
Foo gets one of these by value, which is dtor'd in Foo. upon return
we dtor the other one. I think this is a problem with the pass-by-value
ABI method. It does look like a bug.
End Quote
>How-To-Repeat:
Compile and run the attached program
>Fix:
None
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="kulvinder.C"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="kulvinder.C"
CgojaW5jbHVkZSA8c3RkaW8uaD4KCmNsYXNzIEMKewogIGludCBtOwogIApwdWJsaWM6CiAgQygp
IHtwcmludGYgKCJjdG9yICVzICVwXG4iLCBfX1BSRVRUWV9GVU5DVElPTl9fLCAodm9pZCAqKXRo
aXMpO307CiAgfkMoKSB7cHJpbnRmICgiZHRvciAlcyAlcFxuIiwgX19QUkVUVFlfRlVOQ1RJT05f
XywgKHZvaWQgKil0aGlzKTt9Owp9OwoKCnZvaWQgRm9vIChDIGMpIHtwcmludGYgKCJpbiBGb28g
JXBcbiIsICh2b2lkICopJmMpO30KCmludCBtYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pCnsg
ICAgICAgCiAgQyBjOwoKICBwcmludGYgKCJCZWZvcmUgRm9vIGluIG1haW4gXG4iKTsKICBGb28g
KGMpOwogIHByaW50ZiAoIkFmdGVyIEZvbyBpbiBtYWluIFxuIik7CiAgcmV0dXJuIDE7Cn0K
More information about the Gcc-prs
mailing list