Commit 2aa953d0 by Jason Merrill Committed by Jason Merrill

re PR c++/56567 (ICE with lambda return type deduction and braced-init-list)

	PR c++/56567
	* typeck.c (check_return_expr): Disallow returning init list here.
	* semantics.c (apply_deduced_return_type): Not here.

From-SVN: r196600
parent a036a589
2013-03-11 Jason Merrill <jason@redhat.com>
PR c++/56567
* typeck.c (check_return_expr): Disallow returning init list here.
* semantics.c (apply_deduced_return_type): Not here.
2013-03-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51412
......
......@@ -9061,12 +9061,6 @@ apply_deduced_return_type (tree fco, tree return_type)
if (return_type == error_mark_node)
return;
if (is_std_init_list (return_type))
{
error ("returning %qT", return_type);
return_type = void_type_node;
}
if (LAMBDA_FUNCTION_P (fco))
{
tree lambda = CLASSTYPE_LAMBDA_EXPR (current_class_type);
......
......@@ -8136,6 +8136,11 @@ check_return_expr (tree retval, bool *no_warning)
"deduced to %<void%>");
type = error_mark_node;
}
else if (retval && BRACE_ENCLOSED_INITIALIZER_P (retval))
{
error ("returning initializer list");
type = error_mark_node;
}
else
{
if (!retval)
......
......@@ -5,7 +5,7 @@
int main()
{
[]{ return { 1, 2 }; }(); // { dg-error "initializer_list" }
[]{ return { 1, 2 }; }(); // { dg-error "initializer.list" }
}
// { dg-prune-output "return-statement with a value" }
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