From: Jason Merrill Date: Wed, 29 Jan 2014 04:10:58 +0000 (-0500) Subject: re PR c++/59791 (ICE: Error reporting routines re-entered. with -fcompare-debug) X-Git-Tag: upstream/12.2.0~65097 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=15b31f8c7e139e3799cba19e61c636eb4b3fccc1;p=platform%2Fupstream%2Fgcc.git re PR c++/59791 (ICE: Error reporting routines re-entered. with -fcompare-debug) PR c++/59791 * pt.c (tsubst_decl) [VAR_DECL]: Allow in unevaluated context. (tsubst_copy): Use it if lookup fails. From-SVN: r207224 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 502f218..31217e7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-01-28 Jason Merrill + PR c++/59791 + * pt.c (tsubst_decl) [VAR_DECL]: Allow in unevaluated context. + (tsubst_copy): Use it if lookup fails. + PR c++/59818 * pt.c (tsubst_function_type): Make sure we keep the same function quals. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 011db2c..7f1b6d5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -10990,9 +10990,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) DECL_TEMPLATE_INFO (r) = build_template_info (tmpl, argvec); SET_DECL_IMPLICIT_INSTANTIATION (r); } - else if (cp_unevaluated_operand) - gcc_unreachable (); - else + else if (!cp_unevaluated_operand) register_local_specialization (r, t); DECL_CHAIN (r) = NULL_TREE; @@ -12481,6 +12479,11 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) } else { + /* This can happen for a variable used in a late-specified + return type of a local lambda. Just make a dummy decl + since it's only used for its type. */ + if (cp_unevaluated_operand) + return tsubst_decl (t, args, complain); gcc_assert (errorcount || sorrycount); return error_mark_node; } diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype1.C new file mode 100644 index 0000000..0ab0cdd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-decltype1.C @@ -0,0 +1,21 @@ +// PR c++/59791 +// We force the gimple dump to trigger use of lang_decl_name. +// { dg-options "-std=c++11 -fdump-tree-gimple" } +// { dg-final { cleanup-tree-dump "gimple" } } + +template < class T > void +f (T t) +{ + int i = t; + [](int)->decltype (i + t) + { + return 0; + } + (0); +} + +void +foo () +{ + f (0); +}