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

2024-04-18

#### 1125.
Unclear definition of “potential constant expression”

**Section: **7.7 [expr.const]
**Status: **C++11
**Submitter: **DE
**Date: **2010-08-02

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

N3092 comment
DE 8

In the definition of “potential constant
expression” in 7.7 [expr.const] paragraph 6,
it is unclear how “arbitrary” the substitution of the
function parameters is. Does it mean “there exists a value
for which the result is a constant expression” or does it
mean “for all possible values, the result needs to be a
constant expression?” Example:

constexpr int f(int x){ return x + 1; }

is a constant expression under the first interpretation,
but not under the second (because overflow occurs for `x
== INT_MAX`, cf 7.7 [expr.const] paragraph 2
bullet 5). The answer also affects expressions such as:

constexpr int f2(bool v) { return v ? throw 0 : 0; }
constexpr int f3(bool v) { return v && (throw 0, 0); }

See also issue 1129.