Summary: | rethrowing exceptions and capturing by reference | ||
---|---|---|---|
Product: | gcc | Reporter: | Marcelo Taube <staube> |
Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | normal | CC: | gcc-bugs, jason |
Priority: | P2 | ||
Version: | 3.3.3 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: |
Description
Marcelo Taube
2004-09-06 13:39:56 UTC
Jason, what is your opinion on this? I have thinked about an additional problem of using the copy constructor for rethrowing (i have just thought about it). If you use the copy constructor for the base class then you will never be able to recatch the exception with a catch for the derived class. In general using the copy constructor of the base class means object-slicing just as if the exception was catched by value and not by reference. Thanks again Marcelo Subject: Re: rethrowing exceptions and capturing by reference If you want to rethrow the current exception without copying, write throw; This is not a bug. Jason jason, you are right, i forgot that. But anyway the compiler used an unexistant copy constructor and builded an object for an ABSTRACT class without issiuing any warnings nor errors. That has to be an error, right? Subject: Re: rethrowing exceptions and capturing by reference On 7 Sep 2004 06:31:02 -0000, "staube at t2 dot technion dot ac dot il" <gcc-bugzilla@gcc.gnu.org> wrote: > But anyway the compiler used an unexistant copy constructor and builded > an object for an ABSTRACT class without issiuing any warnings nor > errors. That has to be an error, right? The copy constructor for class exception exists, it's just trivial. class exception is not abstract. exception::what is not pure virtual. Jason Just as Jason says: use "throw;" |