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.
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.
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.
Change 17.9.8 [except.nested] as depicted:
template <class T> [[noreturn]] void throw_with_nested(T&& t);-6- Let
-7- Requires:U
beremove_reference_t<T>
.U
shall beCopyConstructible
. -8- Throws: ifU
is a non-union class type not derived fromnested_exception
is_class<U>::value && !is_final<U>::value && !is_base_of<nested_exception, U>::value
istrue
, an exception of unspecified type that is publicly derived from bothU
andnested_exception
and constructed fromstd::forward<T>(t)
, otherwisestd::forward<T>(t)
.