From: Paolo Carlini Date: Thu, 4 Aug 2016 19:22:58 +0000 (+0000) Subject: re PR c++/72800 (ICE on invalid C++14 code with initialized lambda capture: tree... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4473482d5bedbb34761791bbe68eae4fefaa85d2;p=gcc.git re PR c++/72800 (ICE on invalid C++14 code with initialized lambda capture: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in add_capture, at cp/lambda.c:505) /cp 2016-08-04 Paolo Carlini PR c++/72800 * lambda.c (add_capture): Check lambda_capture_field_type return value for error_mark_node. /testsuite 2016-08-04 Paolo Carlini PR c++/72800 * g++.dg/cpp1y/lambda-ice1.C: New. From-SVN: r239148 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5ec690d6e2e..c295a85bf70 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-08-04 Paolo Carlini + + PR c++/72800 + * lambda.c (add_capture): Check lambda_capture_field_type return + value for error_mark_node. + 2016-08-04 Patrick Palka PR c++/72759 diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index abb967a9aae..978fa0d841f 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -492,6 +492,8 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p, else { type = lambda_capture_field_type (initializer, explicit_init_p); + if (type == error_mark_node) + return error_mark_node; if (by_reference_p) { type = build_reference_type (type); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c456b1886de..5237b6a1446 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-08-04 Paolo Carlini + + PR c++/72800 + * g++.dg/cpp1y/lambda-ice1.C: New. + 2016-08-04 Patrick Palka PR c++/72759 diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-ice1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-ice1.C new file mode 100644 index 00000000000..86fb88aad17 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-ice1.C @@ -0,0 +1,7 @@ +// PR c++/72800 +// { dg-do compile { target c++14 } } + +void foo () +{ + [n {}] {}; // { dg-error "one element|deducing" } +}