From 6c1e7aa99cf4d918535ebfe59f19e48672a3c9a4 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 27 Jan 2012 00:12:41 +0000 Subject: [PATCH] re PR c++/51370 (ICE with invalid template parameter) /cp 2012-01-26 Paolo Carlini PR c++/51370 * error.c (dump_decl, [TEMPLATE_ID_EXPR]): Handle error_mark_node as TREE_OPERAND (t, 1). /testsuite 2012-01-26 Paolo Carlini PR c++/51370 * g++.dg/template/crash112.C: New. From-SVN: r183593 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/error.c | 11 +++++++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/crash112.C | 15 +++++++++++++++ 4 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/crash112.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e4a3d6f8aba..3df6d1102fc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2012-01-26 Paolo Carlini + + PR c++/51370 + * error.c (dump_decl, [TEMPLATE_ID_EXPR]): Handle error_mark_node + as TREE_OPERAND (t, 1). + 2012-01-24 Jason Merrill PR c++/51917 diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 62b47ca2a36..09c6caec9a4 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1,7 +1,7 @@ /* Call-backs for C++ error reporting. This code is non-reentrant. Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, - 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 + 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of GCC. @@ -1118,14 +1118,17 @@ dump_decl (tree t, int flags) case TEMPLATE_ID_EXPR: { tree name = TREE_OPERAND (t, 0); + tree args = TREE_OPERAND (t, 1); if (is_overloaded_fn (name)) name = DECL_NAME (get_first_fn (name)); dump_decl (name, flags); pp_cxx_begin_template_argument_list (cxx_pp); - if (TREE_OPERAND (t, 1)) - dump_template_argument_list (TREE_OPERAND (t, 1), flags); - pp_cxx_end_template_argument_list (cxx_pp); + if (args == error_mark_node) + pp_string (cxx_pp, M_("