Created on 2014-11-09.00:00:00 last changed 94 months ago
Proposed resolution (September, 2015):
Change 7.7 [expr.const] paragraph 4 as follows:
...binds directly. [Note: such expressions may be used in new expressions (7.6.2.8 [expr.new]), as case expressions (8.5.3 [stmt.switch]), as enumerator initializers if the underlying type is fixed (9.7.1 [dcl.enum]), as array bounds (9.3.4.5 [dcl.array]), and as non-type template arguments (13.4 [temp.arg]). —end note] A contextually converted constant expression of type bool is an expression, contextually converted to bool (7.3 [conv]), where the converted expression is a constant expression and the conversion sequence contains only the conversions above.
Change 9.1 [dcl.pre] paragraph 6 as follows:
In a static_assert-declaration, the constant-expression shall be a contextually converted constant expression of type bool (7.7 [expr.const])that can be contextually converted to bool (7.3 [conv]). If the value of the expression when so converted is true...
Change 14.5 [except.spec] paragraph 1 as follows:
In a noexcept-specification, the constant-expression, if supplied, shall be a contextually converted constant expression of type bool (7.7 [expr.const])that is contextually converted to bool ( 7.3 [conv]). A ( token that follows noexcept...
[Adopted at the February, 2016 meeting.]
According to 14.5 [except.spec] paragraph 1,
In a noexcept-specification, the constant-expression, if supplied, shall be a constant expression (7.7 [expr.const]) that is contextually converted to bool ( 7.3 [conv]).
This allows the expression to have any type that can be converted to bool, which is too lenient; it should instead say something like “a converted constant expression of type bool (7.7 [expr.const]).” This would include the conversion to bool in the determination of whether the expression is constant or not and would also disallow narrowing conversions.
A similar consideration applies to static_assert (9.1 [dcl.pre] paragraph 6), which should probably be recast to something like, “an expression that is a constant expression (7.7 [expr.const]) after contextual conversion to bool (7.3 [conv]).”
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-02-06 00:00:00 | admin | set | status: tentatively ready -> cd4 |
2015-11-10 00:00:00 | admin | set | messages: + msg5616 |
2015-11-10 00:00:00 | admin | set | status: drafting -> tentatively ready |
2014-11-09 00:00:00 | admin | create |