public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9494: Unnecessary copyconstructor call on exception throw
@ 2003-02-01 20:48 bangerth
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-02-01 20:48 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, panagiotis.issaris, takis

Synopsis: Unnecessary copyconstructor call on exception throw

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Sat Feb  1 20:48:07 2003
State-Changed-Why:
    Confirmed, but fixed on mainline.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9494


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/9494: Unnecessary copyconstructor call on exception throw
@ 2003-01-29  8:06 takis
  0 siblings, 0 replies; 2+ messages in thread
From: takis @ 2003-01-29  8:06 UTC (permalink / raw)
  To: gcc-gnats; +Cc: panagiotis.issaris


>Number:         9494
>Category:       c++
>Synopsis:       Unnecessary copyconstructor call on exception throw
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 29 08:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Panagiotis Issaris
>Release:        2.95.3,2.95.4, 3.2.1
>Organization:
>Environment:
Slackware, Debian GNU/Linux
>Description:
When throwing exceptions and they are catched by reference,  the copy constructor is called. The output of the execution of the included C++ sourcecode, shows:
  C Human
  Catch
  D Human
When compiled using the Intel C++ 7.0 compiler while all recent versions of GCC generate code which calls the copy constructor:
  C Human
  CC Human
  D Human
  Catch
  D Human
>How-To-Repeat:
Compile the following sourcecode. The resulting executable will use the copy constructor while (I and Intel C++ 7.0 think) it shouldn't.

#include <iostream>

using namespace std;

class Human
{
    public:
    Human()
    {
        cout << "C Human" << endl;
    }

    ~Human()
    {
        cout << "D Human" << endl;
    }

    Human(const Human &c)
    {
        cout << "CC Human" << endl;
    }
};

int main()
{
    try {
        throw Human();
    }
    catch(Human &e)
    {
        cout << "Catch" << endl;
    }

    return 0;
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-02-01 20:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-01 20:48 c++/9494: Unnecessary copyconstructor call on exception throw bangerth
  -- strict thread matches above, loose matches on Subject: below --
2003-01-29  8:06 takis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).