From 4473482d5bedbb34761791bbe68eae4fefaa85d2 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 4 Aug 2016 19:22:58 +0000 Subject: [PATCH] =?utf8?q?re=20PR=20c++/72800=20(ICE=20on=20invalid=20C++1?= =?utf8?q?4=20code=20with=20initialized=20lambda=20capture:=20tree=20check?= =?utf8?q?:=20expected=20class=20=E2=80=98type=E2=80=99,=20have=20?= =?utf8?q?=E2=80=98exceptional=E2=80=99=20(error=5Fmark)=20in=20add=5Fcapt?= =?utf8?q?ure,=20at=20cp/lambda.c:505)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit /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 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/lambda.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp1y/lambda-ice1.C | 7 +++++++ 4 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-ice1.C 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" } +} -- 2.30.2