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.
throw_with_nested
should not use perfect forwardingSection: 17.9.8 [except.nested] Status: C++11 Submitter: INCITS Opened: 2010-08-25 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [except.nested].
View all issues with C++11 status.
Discussion:
Addresses US-84
The throw_with_nested
specification passes in its argument as
T&&
(perfect forwarding pattern), but then discusses
requirements on T
without taking into account that T
may be an lvalue-reference type. It is also not clear in the spec that
t
is intended to be perfectly forwarded.
[ Resolution proposed by ballot comment ]
Patch [except.nested] p6-7 to match the intent with regards to
requirements on T
and the use of
std::forward<T>(t)
.
[ 2010-10-24 Daniel adds: ]
Accepting n3144 would solve this issue.
[2010-11-10 Batavia: LWG accepts Howard's updated wording with corrected boo boos reported by Sebastian Gesemann and Pete Becker, which is approved for Immediate adoption this meeting.]
[ Adopted at 2010-11 Batavia ]
Proposed resolution:
Change 18.8.7 nested_exception [except.nested] as indicated:
[[noreturn]] template <class T> void throw_with_nested(T&& t);Let
U
beremove_reference<T>::type
6 Requires:
shall be
TUCopyConstructible
.7 Throws: If
is a non-union class type not derived from
TUnested_exception
, an exception of unspecified type that is publicly derived from bothand
TUnested_exception
and constructed fromstd::forward<T>(t)
, otherwise throwsstd::forward<T>(t)
.