Created on 2010-03-17.00:00:00 last changed 130 months ago
[Voted into the WP at the March, 2011 meeting as part of paper N3262.]
Proposed resolution (February, 2011) [SUPERSEDED]:
Change 6.8.2 [basic.fundamental] paragraph 9 as follows:
...Any expression can be explicitly converted to type cv void (7.6.3 [expr.cast]). An expression of type void shall be used only as an expression statement (8.3 [stmt.expr]), as an operand of a comma expression (7.6.20 [expr.comma]), as a second or third operand of ?: (7.6.16 [expr.cond]), as the operand of typeid or decltype,oras the expression in a return statement (8.7.4 [stmt.return]) for a function with the return type void, or as the operand of an explicit conversion to type cv void.
Change 7.6.16 [expr.cond] paragraph 2 as follows:
If either the second or the third operand has type(possibly cv-qualified)void, then...
Change 8.7.4 [stmt.return] paragraph 3 as follows:
A return statement with an expression of type“cvvoid”can be used only in functions with a return type of cv void; the expression is evaluated just before the function returns to its caller.
According to 6.8.2 [basic.fundamental] paragraph 9,
Any expression can be explicitly converted to type cv void (7.6.3 [expr.cast]). An expression of type void shall be used only as an expression statement (8.3 [stmt.expr]), as an operand of a comma expression (7.6.20 [expr.comma]), as a second or third operand of ?: (7.6.16 [expr.cond]), as the operand of typeid, or as the expression in a return statement (8.7.4 [stmt.return]) for a function with the return type void.
First, this is self-contradictory: if “any expression” can be converted to void, why is such a conversion not listed among the acceptable uses of an expression of type void?
Second, presumably an expression of type void can be used as an operand of decltype, but this use is not listed.
Finally, there are several places in the Standard that speak of expressions having a cv-qualified void type (7.6.16 [expr.cond] paragraph 2, 8.7.4 [stmt.return] paragraph 3) . However, an expression of type void is a non-class prvalue, and there are no cv-qualified non-class prvalues (7.2.1 [basic.lval] paragraph 4).
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 | messages: + msg3304 |
2011-04-10 00:00:00 | admin | set | status: review -> fdis |
2011-02-28 00:00:00 | admin | set | messages: + msg3239 |
2011-02-28 00:00:00 | admin | set | status: drafting -> review |
2010-08-23 00:00:00 | admin | set | status: open -> drafting |
2010-03-17 00:00:00 | admin | create |