Hi,

fix another simple ICE on invalid regression (the ICE is in get_innermost_template_args). Tested x86_64-linux.

Thanks,
Paolo.

PS: happens in 4_8-branch too but I don't think it's worth backporting.

/////////////////
/cp
2014-01-29  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/58674
        * pt.c (instantiate_template_1): Check for error_mark_node the second
        argument too.

/testsuite
2014-01-29  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/58674
        * g++.dg/cpp0x/pr58674.C: New.
Index: cp/pt.c
===================================================================
--- cp/pt.c     (revision 207234)
+++ cp/pt.c     (working copy)
@@ -15258,6 +15258,9 @@ instantiate_template_1 (tree tmpl, tree orig_args,
       return NULL_TREE;
     }
 
+  if (targ_ptr == error_mark_node)
+    return error_mark_node;
+
   /* Check to see if we already have this specialization.  */
   gen_tmpl = most_general_template (tmpl);
   if (tmpl != gen_tmpl)
Index: testsuite/g++.dg/cpp0x/pr58674.C
===================================================================
--- testsuite/g++.dg/cpp0x/pr58674.C    (revision 0)
+++ testsuite/g++.dg/cpp0x/pr58674.C    (working copy)
@@ -0,0 +1,18 @@
+// PR c++/58674
+// { dg-do compile { target c++11 } }
+
+template<int> struct A {};
+
+template<int N> using B = A<N>;
+
+template<typename T> struct C
+{
+  B<T::i> b;  // { dg-error "not usable" }
+};
+
+struct X
+{
+  static const int i;
+};
+
+C<X> c;

Reply via email to