c++/5605: Wrong constructor is called when anonymous object is created in catch block.

cs@plesk.com cs@plesk.com
Wed Feb 6 01:46:00 GMT 2002


>Number:         5605
>Category:       c++
>Synopsis:       Wrong constructor is called when anonymous object is created in catch block.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 06 00:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     cs@plesk.com
>Release:        at least 2.95.3 and 3.0.3
>Organization:
>Environment:
I'm sure it doesn't matter, at least on FreeBSD 4.3, 4.5 and RedHat 7.2 on i386.
>Description:
When executing a code like:

try {
   // .....
} catch (SomeException &e) {
     SomeClass(e);
}
will be called SomeClass::SomeClass() constructor instead of
SomeClass(SomeException) or something like.
>How-To-Repeat:
Just compile and run file attached. it outputs 
A::A()
instead of 
A::A(int)
>Fix:
Don't know
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.cpp"

I2luY2x1ZGUgPHN0ZGlvLmg+CmNsYXNzIEEgewpwdWJsaWM6CglBKCkKCXsKCQlwcmludGYoIiVz
XG4iLCBfX1BSRVRUWV9GVU5DVElPTl9fKTsKCX0KCUEoaW50KQoJewoJCXByaW50ZigiJXNcbiIs
IF9fUFJFVFRZX0ZVTkNUSU9OX18pOwoJfQp9OwoKbWFpbigpCnsKCXRyeSB7CgkJdGhyb3cgNjY2
OwoJfSBjYXRjaCAoaW50ICYgZSkgewoJCUEgKGUpOwoJfQp9Cg==



More information about the Gcc-bugs mailing list