<div>On Tue, May 22, 2012 at 6:54 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When a lambda expression omits the return type information, the<br>
standard requires the lambda statement body to be a single return<br>
statement.  However, as a language extension, we (and several other<br>
compilers) support determining the return type if all of the<br>
function's return types agree.<br>
<br>
The problem is, the wording for the warning we emit is a bit difficult<br>
to parse.  It's a semantically correct statement, but it's not<br>
immediately obvious what the problem is or how to rectify it.<br>
Consider:<br>
<br>
auto i = []() { static const int foo = 12; return &foo; }();<br>
<br>
This will emit a diagnostic that says "C++11 requires lambda with<br>
omitted result type to consist of a single return statement" --<br>
however, a likely initial response to this is "but I do only have a<br>
single return statement!"<br>
<br>
This patch rewords the diagnostic to be a bit more clear (hopefully):<br>
"C++11 requires a lambda expression with omitted result type to<br>
consist solely of a return statement"<br>
<br>
Thoughts?</blockquote><div><br></div><div>I would be in favor of removing the warning entirely, now that Clang 3.1 has shipped. The C++ core working group has already agreed that this should be allowed. It's currently under consideration by the evolution working group, whom I think are unlikely to say no -- and if they do, we will have time to react before 3.2 is released.</div>
</div>