Hi,
a small diagnostic regression, pretty easy to fix: checking the value
returned by tsubst avoids crashing later in the template_class_depth
loop. Tested x86_64-linux.
Thanks,
Paolo.
////////////////////////
/cp
2012-01-20 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/51402
* pt.c (lookup_template_class_1): Check context returned by
tsubst for error_mark_node.
/testsuite
2012-01-20 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/51402
* g++.dg/template/crash110.C: New.
Index: testsuite/g++.dg/template/crash110.C
===================================================================
--- testsuite/g++.dg/template/crash110.C (revision 0)
+++ testsuite/g++.dg/template/crash110.C (revision 0)
@@ -0,0 +1,7 @@
+// PR c++/51402
+
+template<void> struct A // { dg-error "not a valid type" }
+{
+ template<int,int> struct B {};
+ template<int N> struct B<N,N> {};
+};
Index: cp/pt.c
===================================================================
--- cp/pt.c (revision 183335)
+++ cp/pt.c (working copy)
@@ -1,6 +1,6 @@
/* Handle parameterized types (templates) for GNU C++.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
+ 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Written by Ken Raeburn (raeb...@cygnus.com) while at Watchmaker Computing.
Rewritten by Jason Merrill (ja...@cygnus.com).
@@ -7466,6 +7466,9 @@ lookup_template_class_1 (tree d1, tree arglist, tr
context = tsubst (DECL_CONTEXT (gen_tmpl), arglist,
complain, in_decl);
+ if (context == error_mark_node)
+ return error_mark_node;
+
if (!context)
context = global_namespace;