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

2024-12-19


1597. Misleading constexpr example

Section: 9.2.6  [dcl.constexpr]     Status: CD3     Submitter: John Spicer     Date: 2012-12-21

[Addressed by the adoption of paper N3652 at the April, 2013 meeting.]

One of the examples in 9.2.6 [dcl.constexpr] paragraph 3 reads,

  constexpr int prev(int x)
    { return --x; }      // error: use of decrement

According to paragraph 5, this ill-formed, no diagnostic required:

For a constexpr function, if no function argument values exist such that the function invocation substitution would produce a constant expression (7.7 [expr.const]), the program is ill-formed; no diagnostic required.

However, the surrounding errors in the example have required diagnostics, potentially leading the reader to the mistaken conclusion that this error must be diagnosed as well. The example should be removed or the comment updated to reflect its true status.

Proposed resolution (June, 2013):

This issue is no longer relevant after the adoption of the changes to constexpr in paper N3652.