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

### 2483. `throw_with_nested()` should use `is_final`

Section: 17.9.8 [except.nested] Status: C++17 Submitter: Stephan T. Lavavej Opened: 2015-03-27 Last modified: 2017-07-30

Priority: 2

View all other issues in [except.nested].

View all issues with C++17 status.

Discussion:

When N2559 was voted into the Working Paper, it said "This function template must take special case to handle non-class types, unions and `[[final]]` classes that cannot be derived from, and [...]". However, its Standardese didn't handle `final` classes, and this was never revisited. Now that we have `is_final`, we can achieve this proposal's original intention.

Additionally, we need to handle the case where `U` is `nested_exception` itself. `is_base_of`'s wording handles this and ignores cv-qualifiers. (Note that `is_class` detects "non-union class type".)

[2015-05, Lenexa]

STL, MC and JW already do this
MC: move to Ready, bring to motion on Friday
7 in favor, none opposed

Proposed resolution:

This wording is relative to N4296.

1. Change 17.9.8 [except.nested] as depicted:

   >     template <class T> [[noreturn]] void throw_with_nested(T&& t);

   > > -6- Let `U` be `remove_reference_t<T>`.

   > > -7- Requires: `U` shall be `CopyConstructible`.

   > > -8- Throws: if `U` is a non-union class type not derived from `nested_exception` `is_class<U>::value && !is_final<U>::value && !is_base_of<nested_exception, U>::value` is `true`, an exception of unspecified type that is publicly derived from both `U` and `nested_exception` and constructed from `std::forward<T>(t)`, otherwise `std::forward<T>(t)`.