This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.
exception_ptr
should support contextual conversion to bool
Section: 17.9.7 [propagation] Status: Resolved Submitter: Daniel Krügler Opened: 2007-06-06 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [propagation].
View all issues with Resolved status.
Discussion:
As of
N2857
17.9.7 [propagation] p.5, the implementation-defined type
exception_ptr
does provide the following ways to check whether
it is a null value:
void f(std::exception_ptr p) { p == nullptr; p == 0; p == exception_ptr(); }
This is rather cumbersome way of checking for the null value and I suggest to require support for evaluation in a boolean context like so:
void g(std::exception_ptr p) { if (p) {} !p; }
[ 2009 Santa Cruz: ]
Move to Ready. Note to editor: considering putting in a cross-reference to 7.3 [conv], paragraph 3, which defines the phrase "contextually converted to
bool
".
[ 2010-03-14 Howard adds: ]
We moved N3073 to the formal motions page in Pittsburgh which should obsolete this issue. I've moved this issue to NAD Editorial, solved by N3073.
Rationale:
Solved by N3073.
Proposed resolution:
In section 17.9.7 [propagation] insert a new paragraph between p.5 and p.6:
An object
e
of typeexception_ptr
can be contextually converted tobool
. The effect shall be as ife != exception_ptr()
had been evaluated in place ofe
. There shall be no implicit conversion to arithmetic type, to enumeration type or to pointer type.