Created on 2010-08-02.00:00:00 last changed 131 months ago
[Voted into the WP at the November, 2010 meeting as paper N3218.]
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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: fdis -> c++11 |
2011-04-10 00:00:00 | admin | set | status: dr -> fdis |
2010-11-29 00:00:00 | admin | set | status: drafting -> dr |
2010-10-18 00:00:00 | admin | set | status: ready -> drafting |
2010-08-23 00:00:00 | admin | set | messages: + msg2768 |
2010-08-02 00:00:00 | admin | create |