This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 113d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-03-20


1129. Default nothrow for constexpr functions

Section: 9.2.6  [dcl.constexpr]     Status: C++11     Submitter: GB     Date: 2010-08-02

[Voted into the WP at the November, 2010 meeting.]

N3092 comment GB 29

A constexpr function is not permitted to return via an exception. This should be recognised, and a function declared constexpr without an explicit exception specification should be treated as if declared noexcept(true) rather than the usual noexcept(false). For a function template declared constexpr without an explicit exception specification, it should be considered noexcept(true) if and only if the constexpr keyword is respected on a given instantiation.

See also issue 1125.

Notes from the August, 2010 meeting:

The premise is not correct: an exception is forbidden only when a constexpr function is invoked in a context that requires a constant expression. Used as an ordinary function, it can throw.

Proposed resolution (August, 2010):

Change 7.6.2.7 [expr.unary.noexcept] bullet 3.1 as follows: