re PR c++/58566 ([c++11] ICE with invalid expression in lambda body)

PR c++/58566

/cp
2015-10-12  Ville Voutilainen  <ville.voutilainen@gmail.com>

	PR c++/58566
	* lambda.c (lambda_return_type): Return error_mark_node
	instead of void_type_node for the error cases.

/testsuite
2015-10-12  Ville Voutilainen  <ville.voutilainen@gmail.com>

	PR c++/58566
	* g++.dg/cpp0x/lambda/lambda-58566.C: New.

From-SVN: r228706
This commit is contained in:
Ville Voutilainen 2015-10-12 11:55:19 +03:00 committed by Ville Voutilainen
parent 15f128a719
commit 7624ca36a2
4 changed files with 22 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2015-10-12 Ville Voutilainen <ville.voutilainen@gmail.com>
PR c++/58566
* lambda.c (lambda_return_type): Return error_mark_node
instead of void_type_node for the error cases.
2015-10-08 Jason Merrill <jason@redhat.com>
* cp-tree.h (SIMPLE_TARGET_EXPR_P): New.

View File

@ -175,7 +175,7 @@ lambda_return_type (tree expr)
|| BRACE_ENCLOSED_INITIALIZER_P (expr))
{
cxx_incomplete_type_error (expr, TREE_TYPE (expr));
return void_type_node;
return error_mark_node;
}
gcc_checking_assert (!type_dependent_expression_p (expr));
return cv_unqualified (type_decays_to (unlowered_expr_type (expr)));

View File

@ -1,3 +1,8 @@
2015-10-12 Ville Voutilainen <ville.voutilainen@gmail.com>
PR c++/58566
* g++.dg/cpp0x/lambda/lambda-58566.C: New.
2015-10-10 Jan Hubicka <hubicka@ucw.cz>
* gfortran.dg/lto/bind_c-2_0.f90: New testcase.

View File

@ -0,0 +1,10 @@
// PR c++/58566
// { dg-do compile { target c++11 } }
struct A
{
int foo()
{
[this]{ return foo; }; // { dg-error "invalid use of member function|cannot convert" }
}
};