Commit 95b24c84 by Jason Merrill Committed by Jason Merrill

re PR c++/43875 ([C++0x] ICE on invalid lambda return)

	PR c++/43875
	* semantics.c (lambda_return_type): Complain about
	braced-init-list.

From-SVN: r158805
parent 60bfcbec
2010-04-27 Jason Merrill <jason@redhat.com>
PR c++/43875
* semantics.c (lambda_return_type): Complain about
braced-init-list.
PR c++/43790
* tree.c (cv_unqualified): Handle error_mark_node.
......
......@@ -5521,6 +5521,11 @@ tree
lambda_return_type (tree expr)
{
tree type;
if (BRACE_ENCLOSED_INITIALIZER_P (expr))
{
warning (0, "cannot deduce lambda return type from a braced-init-list");
return void_type_node;
}
if (type_dependent_expression_p (expr))
{
type = cxx_make_type (DECLTYPE_TYPE);
......
2010-04-27 Jason Merrill <jason@redhat.com>
PR c++/43875
* g++.dg/cpp0x/lambda/lambda-deduce2.C: New.
2010-04-27 Manuel López-Ibáñez <manu@gcc.gnu.org>
Jan Hubicka <hubicka@ucw.cz>
......
// PR c++/43875
// { dg-options "-std=c++0x" }
int main()
{
auto x2 = []{ return { 1, 2 }; }; // { dg-message "return" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment