Title
Misleading constexpr example
Status
cd3
Section
9.2.6 [dcl.constexpr]
Submitter
John Spicer

Created on 2012-12-21.00:00:00 last changed 131 months ago

Messages

Date: 2013-06-15.00:00:00

Proposed resolution (June, 2013):

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

Date: 2013-04-15.00:00:00

[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.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: wp -> cd3
2013-10-14 00:00:00adminsetstatus: accepted -> wp
2013-09-03 00:00:00adminsetmessages: + msg4562
2013-09-03 00:00:00adminsetstatus: drafting -> accepted
2013-05-03 00:00:00adminsetstatus: open -> drafting
2012-12-21 00:00:00admincreate