Title
throw_with_nested() should use is_final
Status
c++17
Section
[except.nested]
Submitter
Stephan T. Lavavej

Created on 2015-03-27.00:00:00 last changed 81 months ago

Messages

Date: 2015-05-07.23:01:40

Proposed resolution:

This wording is relative to N4296.

  1. Change [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_exceptionis_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).

Date: 2015-05-07.23:01:40

[ 2015-05, Lenexa ]

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

Date: 2015-04-02.22:03:03

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".)

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2015-10-27 16:52:45adminsetstatus: ready -> wp
2015-05-07 23:01:40adminsetmessages: + msg7390
2015-05-07 23:01:40adminsetstatus: new -> ready
2015-04-02 21:28:12adminsetmessages: + msg7311
2015-03-27 00:00:00admincreate