Created on 2009-03-11.00:00:00 last changed 130 months ago
[Voted into the WP at the March, 2011 meeting as part of paper N3268.]
Notes from the March, 2010 meeting:
The new wording added in 7.7 [expr.const] in support of reference parameters for constexpr functions should also be considered to see whether additional changes are needed.
Proposed resolution (March, 2010):
Change 8.7.4 [stmt.return] paragraph 2 as follows:
A return statementwithout an expressionwith neither an expression nor a braced-init-list can be used only in functions that do not return a value...
Change 9.2.6 [dcl.constexpr] paragraph 3 bullets 4 and 5 as follows:
its function-body shall be a compound-statement of the form
where expression is a potential constant expression (5.19), or
where every assignment-expression that is an initializer-clause appearing directly or indirectly within the braced-init-list is a potential constant expression
every constructor call and implicit conversion
used in converting expression to the function return
type initializing the return value
(8.7.4 [stmt.return], 9.4 [dcl.init])
shall be one of those allowed in a constant expression
(7.7 [expr.const]).
The body of a constexpr function is required by 9.2.6 [dcl.constexpr] paragraph 3 to be of the form
However, there does not seem to be any good reason for prohibiting the alternate return syntax involving a braced-init-list. The restriction should be removed.
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: + msg3326 |
2011-04-10 00:00:00 | admin | set | status: drafting -> fdis |
2010-03-29 00:00:00 | admin | set | messages: + msg2577 |
2010-03-29 00:00:00 | admin | set | status: review -> drafting |
2010-02-16 00:00:00 | admin | set | messages: + msg2533 |
2010-02-16 00:00:00 | admin | set | status: drafting -> review |
2009-08-03 00:00:00 | admin | set | status: open -> drafting |
2009-03-11 00:00:00 | admin | create |