Created on 2002-07-29.00:00:00 last changed 197 months ago
[Voted into WP at the October, 2006 meeting.]
Proposed resolution (October, 2005):
Change the last sentence of 7.7 [expr.const] as indicated:
In particular, except in sizeof expressions, functions, class objects, pointers, or references shall not be used, and assignment, increment, decrement,function-callfunction call (including new-expressions and delete-expressions),orcomma operators, or throw-expressions shall not be used.
Note: this sentence is also changed by the resolution of issue 530.
Notes from the April, 2005 meeting:
Although it could be argued that all three of these operators potentially involve function calls — throw to std::terminate, new and delete to the corresponding allocation and deallocation functions — and thus would already be excluded from constant expressions, this reasoning was considered to be too subtle to allow closing the issue with no change. A modification that explicitly clarifies the status of these operators will be drafted.
Notes from October 2002 meeting:
We should also check on new and delete.
The following translation unit appears to be well-formed.
int x[true?throw 4:5];
According to 7.7 [expr.const], this appears to be an integral constant expression: it is a conditional expression, involves only literals, and no assignment, increment, decrement, function-call, or comma operators. However, if this is well-formed, the standard gives no meaning to this declaration, since the array bound (9.3.4.5 [dcl.array] paragraph 1) cannot be computed.
I believe the defect is that throw expressions should also be banned from constant expressions.
History | |||
---|---|---|---|
Date | User | Action | Args |
2008-10-05 00:00:00 | admin | set | status: wp -> cd1 |
2007-05-06 00:00:00 | admin | set | status: dr -> wp |
2006-11-05 00:00:00 | admin | set | messages: + msg1433 |
2006-11-05 00:00:00 | admin | set | status: ready -> dr |
2006-04-22 00:00:00 | admin | set | status: review -> ready |
2005-10-22 00:00:00 | admin | set | messages: + msg1234 |
2005-10-22 00:00:00 | admin | set | status: drafting -> review |
2005-05-01 00:00:00 | admin | set | messages: + msg1158 |
2002-11-08 00:00:00 | admin | set | messages: + msg750 |
2002-11-08 00:00:00 | admin | set | status: open -> drafting |
2002-07-29 00:00:00 | admin | create |