From 272dc8514341566a82eeba15fc1ebc78bb058358 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 15 Dec 2010 17:35:04 +0000 Subject: re PR c++/42083 ([C++0x] ICE on invalid with "tree check: expected aggr_init_expr, have error_mark in build_value_init") /cp 2010-12-15 Paolo Carlini PR c++/42083 * init.c (build_value_init): Check build_special_member_call return value for error_mark_node. /testsuite 2010-12-15 Paolo Carlini PR c++/42083 * g++.dg/cpp0x/lambda/lambda-ice2.C: New. From-SVN: r167862 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/init.c | 8 +++++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C | 16 ++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 142dd53..6dd121a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2010-12-15 Paolo Carlini + + PR c++/42083 + * init.c (build_value_init): Check build_special_member_call return + value for error_mark_node. + 2010-12-14 Jason Merrill PR c++/46930 diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 5a4f91c..9c3dd32 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -314,9 +314,11 @@ build_value_init (tree type, tsubst_flags_t complain) tree ctor = build_special_member_call (NULL_TREE, complete_ctor_identifier, NULL, type, LOOKUP_NORMAL, complain); - - ctor = build_aggr_init_expr (type, ctor); - AGGR_INIT_ZERO_FIRST (ctor) = 1; + if (ctor != error_mark_node) + { + ctor = build_aggr_init_expr (type, ctor); + AGGR_INIT_ZERO_FIRST (ctor) = 1; + } return ctor; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9c71bba..1d865c6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-12-15 Paolo Carlini + + PR c++/42083 + * g++.dg/cpp0x/lambda/lambda-ice2.C: New. + 2010-12-15 H.J. Lu * gfortran.dg/debug/pr46756.f: Correct PR number. diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C new file mode 100644 index 0000000..352137a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C @@ -0,0 +1,16 @@ +// PR c++/42083 +// { dg-options "-std=c++0x" } + +template +decltype(F()) run(F f) // { dg-message "note" } +{ + return f(); +} + +int main() +{ + auto l = []() { return 5; }; + + run(l); // { dg-error "no match" } + // { dg-message "candidate" "candidate note" { target *-*-* } 14 } +} -- cgit v1.1