This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

### 819. rethrow_if_nested

Section: 17.9.8 [except.nested] Status: C++11 Submitter: Alisdair Meredith Opened: 2008-03-25 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [except.nested].

View all issues with C++11 status.

Discussion:

Looking at the wording I submitted for `rethrow_if_nested`, I don't think I got it quite right.

The current wording says:

>     template <class E> void rethrow_if_nested(const E& e);

> > Effects: Calls `e.rethrow_nested()` only if `e` is publicly derived from `nested_exception`.

This is trying to be a bit subtle, by requiring `e` (not `E`) to be publicly derived from `nested_exception` the idea is that a `dynamic_cast` would be required to be sure. Unfortunately, if `e` is dynamically but not statically derived from `nested_exception`, `e.rethrow_nested()` is ill-formed.

[ San Francisco: ]

> Alisdair was volunteered to provide wording.

[ 2009-10 Santa Cruz: ]

> Leave as Open. Alisdair to provide wording.

[ 2009-11-09 Alisdair provided wording. ]

[ 2010-03-10 Dietmar updated wording. ]

[ 2010 Pittsburgh: ]

> Moved to Ready for Pittsburgh.

Proposed resolution:

Change 17.9.8 [except.nested], p8:

>     template <class E> void rethrow_if_nested(const E& e);

> > -8- Effects: Calls `e.rethrow_nested()` o Only if the dynamic type of `e` is publicly and unambiguously derived from `nested_exception` this calls `dynamic_cast<const nested_exception&>(e).rethrow_nested()`.