Title
Disambiguation of noexcept
Status
c++14
Section
14.5 [except.spec]
Submitter
Richard Smith

Created on 2013-08-13.00:00:00 last changed 113 months ago

Messages

Date: 2014-02-15.00:00:00

[Moved to DR at the February, 2014 meeting.]

Date: 2013-09-15.00:00:00

Proposed resolution (September, 2013):

Change 14.5 [except.spec] paragraph 1 as follows:

...In a noexcept-specification, the constant-expression, if supplied, shall be a constant expression (7.7 [expr.const]) that is contextually converted to bool (7.3 [conv]). A noexcept-specification noexcept is equivalent to noexcept( true). A ( token that follows noexcept is part of the noexcept-specification (and does not commence an initializer (9.4 [dcl.init]).
Date: 2013-10-14.00:00:00
N3690 comment CA 27

There is an ambiguity between a noexcept specifier's optional parenthesized constant-expression and an initializer:

  void f() noexcept;
  void (*p)() noexcept (&f);

Here, we can just about make 9.3.3 [dcl.ambig.res] paragraph 1's rule fit, and say that the (&f) is part of the exception-specification rather than being an initializer. However, this case is much more problematic:

  void (*fp2)() noexcept, (*fp)() noexcept (fp2 = 0);

The (fp = 0) here is unambiguously an initializer, because an assignment-expression cannot syntactically be a constant-expression, although current implementations treat it as an ill-formed part of the exception-specification.

Probably the best approach would be to change 14.5 [except.spec] to say that a ( following noexcept is always treated as being part of the noexcept-specification.

History
Date User Action Args
2014-11-24 00:00:00adminsetstatus: dr -> c++14
2014-03-03 00:00:00adminsetmessages: + msg4970
2014-03-03 00:00:00adminsetstatus: ready -> dr
2013-10-14 00:00:00adminsetmessages: + msg4605
2013-10-14 00:00:00adminsetstatus: open -> ready
2013-08-13 00:00:00admincreate