Commit e48243d8 by Jason Merrill Committed by Jason Merrill

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

	PR c++/56567
	* semantics.c (apply_deduced_return_type): Don't allow returning
	std::initializer_list.

From-SVN: r196548
parent ecd4f20a
2013-03-08 Jason Merrill <jason@redhat.com>
PR c++/56567
* semantics.c (apply_deduced_return_type): Don't allow returning
std::initializer_list.
2013-03-06 Paolo Carlini <paolo.carlini@oracle.com> 2013-03-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56534 PR c++/56534
......
...@@ -9061,6 +9061,12 @@ apply_deduced_return_type (tree fco, tree return_type) ...@@ -9061,6 +9061,12 @@ apply_deduced_return_type (tree fco, tree return_type)
if (return_type == error_mark_node) if (return_type == error_mark_node)
return; return;
if (is_std_init_list (return_type))
{
error ("returning %qT", return_type);
return_type = void_type_node;
}
if (LAMBDA_FUNCTION_P (fco)) if (LAMBDA_FUNCTION_P (fco))
{ {
tree lambda = CLASSTYPE_LAMBDA_EXPR (current_class_type); tree lambda = CLASSTYPE_LAMBDA_EXPR (current_class_type);
......
// PR c++/56567
// { dg-require-effective-target c++11 }
#include <initializer_list>
int main()
{
[]{ 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