From: Ville Voutilainen Date: Mon, 12 Oct 2015 08:55:19 +0000 (+0300) Subject: re PR c++/58566 ([c++11] ICE with invalid expression in lambda body) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7624ca36a275ec0c86f6740b079dcc08215883bf;p=gcc.git re PR c++/58566 ([c++11] ICE with invalid expression in lambda body) PR c++/58566 /cp 2015-10-12 Ville Voutilainen 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 PR c++/58566 * g++.dg/cpp0x/lambda/lambda-58566.C: New. From-SVN: r228706 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e89fd022933..517ce522960 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-10-12 Ville Voutilainen + + 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 * cp-tree.h (SIMPLE_TARGET_EXPR_P): New. diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index ceab6469574..b4f19af6eff 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -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))); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b558a9e9723..f4b7d26d920 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-10-12 Ville Voutilainen + + PR c++/58566 + * g++.dg/cpp0x/lambda/lambda-58566.C: New. + 2015-10-10 Jan Hubicka * gfortran.dg/lto/bind_c-2_0.f90: New testcase. diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C new file mode 100644 index 00000000000..3101d0a895c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C @@ -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" } + } +};