1135. exception_ptr should support contextual conversion to bool

Section: 21.8.6 [propagation] Status: Resolved Submitter: Daniel Krügler Opened: 2007-06-06 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [propagation].

View all issues with Resolved status.

Discussion:

As of N2857 21.8.6 [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 [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 21.8.6 [propagation] insert a new paragraph between p.5 and p.6:

An object e of type exception_ptr can be contextually converted to bool. The effect shall be as if e != exception_ptr() had been evaluated in place of e. There shall be no implicit conversion to arithmetic type, to enumeration type or to pointer type.