Hi!

If the second argument to TEMPLATE_ID_EXPR is NULL, there are no
explicit arguments, but we can't call copy_node (NULL).

Fixed thusly, acked by Jason in the PR, bootstrapped/regtested on
x86_64-linux and i686-linux, committed to trunk.

2013-03-06  Jakub Jelinek  <ja...@redhat.com>

        PR c++/56543
        * tree.c (strip_typedefs): Don't copy args if they are NULL.

        * g++.dg/template/typename20.C: New test.

--- gcc/cp/tree.c.jj    2013-02-24 19:44:07.000000000 +0100
+++ gcc/cp/tree.c       2013-03-06 13:49:38.182189955 +0100
@@ -1222,7 +1222,8 @@ strip_typedefs (tree t)
     case TYPENAME_TYPE:
       {
        tree fullname = TYPENAME_TYPE_FULLNAME (t);
-       if (TREE_CODE (fullname) == TEMPLATE_ID_EXPR)
+       if (TREE_CODE (fullname) == TEMPLATE_ID_EXPR
+           && TREE_OPERAND (fullname, 1))
          {
            tree args = TREE_OPERAND (fullname, 1);
            tree new_args = copy_node (args);
--- gcc/testsuite/g++.dg/template/typename20.C.jj       2013-03-06 
14:05:42.381512570 +0100
+++ gcc/testsuite/g++.dg/template/typename20.C  2013-03-06 14:05:29.000000000 
+0100
@@ -0,0 +1,11 @@
+// PR c++/56543
+
+template <typename>
+struct S;
+
+template <typename T>
+struct U
+{
+  typedef typename S <T>::template V <> W;
+  S <W> x;
+};

        Jakub

Reply via email to