New paper: N3582, Return Type Deduction for Normal Functions (Revision 3) -- Jason Merrill
[Ed.: Also of broad interest and on track for near-term standardization.]
A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.
Document number: N3582
Date: 2013-03-15
Return Type Deduction for Normal Functions (Revision 3)
by Jason Merrill
Excerpt:
Any C++ user introduced to the C++11 features of
auto
, lambdas, and trailing return types immediately wonders why they can't just writeauto
on their function declaration and have the return type deduced. This functionality was proposed previously in N2954, but dropped from C++11 due to time constraints, as the drafting didn't address various questions and concerns that the Core WG had. I have now implemented this functionality in GCC, and propose to add it to C++14. I discuss some of the less obvious aspects of the semantics below.This proposal also resolves core DRs 975 (lambda return type deduction from multiple return statements) and 1048 (inconsistency between
auto
and lambda return type deduction).