From e5e58dbe28b71a17cb2e3e02fdf42d654e6ccd00 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 12 Aug 2015 14:02:35 -0400 Subject: [PATCH] re PR c++/67108 (ICE: in cxx_eval_call_expression, at cp/constexpr.c:1345 when dumping) PR c++/67108 * decl2.c (c_parse_final_cleanups): Set at_eof to 2 at end. * error.c (dump_template_bindings): Don't tsubst in that case. From-SVN: r226829 --- gcc/cp/ChangeLog | 4 ++ gcc/cp/cp-tree.h | 3 +- gcc/cp/decl2.c | 3 ++ gcc/cp/error.c | 5 +++ gcc/testsuite/g++.dg/cpp0x/constexpr-targ3.C | 40 ++++++++++++++++++++ 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-targ3.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bed0a5eb023..4f3f46dda34 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2015-08-12 Jason Merrill + PR c++/67108 + * decl2.c (c_parse_final_cleanups): Set at_eof to 2 at end. + * error.c (dump_template_bindings): Don't tsubst in that case. + PR c++/67161 * error.c (dump_decl) [TEMPLATE_ID_EXPR]: Pass TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 78fd4af0a2f..ab6b3ec6206 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4797,7 +4797,8 @@ extern GTY(()) vec *local_classes; #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */ -/* Nonzero if we're done parsing and into end-of-file activities. */ +/* Nonzero if we're done parsing and into end-of-file activities. + Two if we're done with front-end processing. */ extern int at_eof; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 068d79cd10c..8e7a453ec1b 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4846,6 +4846,9 @@ c_parse_final_cleanups (void) timevar_stop (TV_PHASE_DEFERRED); timevar_start (TV_PHASE_PARSING); + + /* Indicate that we're done with front end processing. */ + at_eof = 2; } /* Perform any post compilation-proper cleanups for the C++ front-end. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index ae3e0921c5c..faf8744e225 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -339,6 +339,11 @@ dump_template_bindings (cxx_pretty_printer *pp, tree parms, tree args, && !DECL_LANG_SPECIFIC (current_function_decl)) return; + /* Don't try to do this once cgraph starts throwing away front-end + information. */ + if (at_eof >= 2) + return; + FOR_EACH_VEC_SAFE_ELT (typenames, i, t) { if (need_semicolon) diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-targ3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-targ3.C new file mode 100644 index 00000000000..d1e44827a3c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-targ3.C @@ -0,0 +1,40 @@ +// PR c++/67108 +// { dg-do compile { target c++11 } } + +template < typename, typename > struct is_same; +template < typename T > struct is_same +{ + enum + { + value = true + } + ; + constexpr bool operator () () + { + return value; + } +} + ; +template < bool, typename = void >struct enable_if; +template < typename T > struct enable_if +{ + typedef T type; +} + ; +struct A; +template < typename, typename = void >struct F; +template < typename X > struct F +{ +} + () >::type > +{ + template < typename MakeDependent > F (MakeDependent) + { + } +} +; + +int main () +{ + F < A > (1); +} -- 2.30.2