/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Jan 2012 17:21:19 +0000 (17:21 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Jan 2012 17:21:19 +0000 (17:21 +0000)
2012-01-20  Paolo Carlini  <paolo.carlini@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.carlini@oracle.com>

PR c++/51402
* g++.dg/template/crash110.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183345 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/crash110.C [new file with mode: 0644]

index 610baa2..94e6dc9 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/51402
+       * pt.c (lookup_template_class_1): Check context returned by
+       tsubst for error_mark_node.
+
 2012-01-19  Kai Tietz  <ktietz@redhat.com>
 
        PR c++/51344
index 87ec5f5..a4460f1 100644 (file)
@@ -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 (raeburn@cygnus.com) while at Watchmaker Computing.
    Rewritten by Jason Merrill (jason@cygnus.com).
@@ -7466,6 +7466,9 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
 
       context = tsubst (DECL_CONTEXT (gen_tmpl), arglist,
                        complain, in_decl);
+      if (context == error_mark_node)
+       return error_mark_node;
+
       if (!context)
        context = global_namespace;
 
index 8da1e54..7db1f79 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/51402
+       * g++.dg/template/crash110.C: New.
+
 2012-01-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * gcc.misc-tests/gcov-14.c: Skip on alpha*-dec-osf*.
diff --git a/gcc/testsuite/g++.dg/template/crash110.C b/gcc/testsuite/g++.dg/template/crash110.C
new file mode 100644 (file)
index 0000000..d0a4b4d
--- /dev/null
@@ -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> {};
+};