Topic: Defect Report: exception handler matching


Author: scott douglass <sdouglass@arm.com>
Date: 2000/03/06
Raw View
[ Forwarded to the C++ Committee. -sdc ]

This is a request for an editorial change.  In 15.3 the standard says:

 >>
A _handler_ is a match for a _throw-expression_ with an object type E if
<<

I think this should be changed to something like:

 >>
A _handler_ is a match for a _throw-expression_ which initialized a temporary object ([except.throw]) of type E if
<<

This makes it clear that the type being matched in the following example is 'B' and not 'const D':

struct B { B(); virtual ~B(); };
struct D : B { D(); };
void toss(const B* b) { throw *b; }
void f() { const D d; toss(&d); }

That is, the dynamic type has been sliced and top-level constness has been lost as described in 15.1 [except.throw].



[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]