Commit 6c1e7aa9 by Paolo Carlini Committed by Paolo Carlini

re PR c++/51370 (ICE with invalid template parameter)

/cp
2012-01-26  Paolo Carlini  <paolo.carlini@oracle.com>

	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  <paolo.carlini@oracle.com>

	PR c++/51370
	* g++.dg/template/crash112.C: New.

From-SVN: r183593
parent 2fda54bd
2012-01-26 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51370
* error.c (dump_decl, [TEMPLATE_ID_EXPR]): Handle error_mark_node
as TREE_OPERAND (t, 1).
2012-01-24 Jason Merrill <jason@redhat.com>
PR c++/51917
......
/* 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_("<template arguments error>"));
else if (args)
dump_template_argument_list (args, flags);
pp_cxx_end_template_argument_list (cxx_pp);
}
break;
......
2012-01-26 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51370
* g++.dg/template/crash112.C: New.
2012-01-27 Richard Henderson <rth@redhat.com>
* gcc.dg/atomic-flag.c: Adjust for __GCC_ATOMIC_TEST_AND_SET_TRUEVAL.
......
// PR c++/51370
struct A
{
template<typename> void foo() {}
};
template<void (A::*)()> struct B {}; // { dg-error "declaration" }
template<int> struct C
{
B<&A::foo<int int> > b; // { dg-error "declaration|type" }
};
C<0> c;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment