[rfc] fix libstdc++/10606
Martin Sebor
sebor@roguewave.com
Wed Jan 5 02:09:00 GMT 2005
Benjamin Kosnik wrote:
...
> For the lazy among us, can you post the test code for constructing
> that table please?
I don't have the original code anymore but the attached program
should be close enough. I just quickly whipped it up so be kind
to me if it's buggy :)
>
> Also, this clarifies/simplifies uncaught_exception to something that
> means true when an exception object (not temporary object) is "in
> flight." I like that part.
Just so there's no misunderstanding: by the temporary object I meant
the unnamed object constructed by the runtime library as a copy of
the value of argument of the throw-expression. I.e., in this snippet:
try {
S s0, s1;
throw 1 ? s0 : s1; // invokes S(const S&) with s0 as argument
}
catch (...) {
throw; // rethrows s2
}
s0 is the /thrown object/. The unnamed temporary object created
by the runtime by invoking the copy ctor for S is known as the
/exception object/ (let's call it s2). The issue proposes to
make it clear that uncaught_exception() returns *false* until
the completion of the evaluation of the expression 1 ? s0 : s1,
and *true* immediately after that, i.e., true in the copy ctor
invoked to copy s0 to s2. This copy is what I would call the
object "in flight" because that's what gets caught by handlers
that catch by reference and what gets rethrown from such handlers
by a throw expression with no operands.
Martin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: t.cpp
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20050105/47e9b709/attachment.ksh>
More information about the Libstdc++
mailing list