]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/56543 (ICE on valid code in copy_node_stat)
authorJakub Jelinek <jakub@redhat.com>
Wed, 6 Mar 2013 15:19:11 +0000 (16:19 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 6 Mar 2013 15:19:11 +0000 (16:19 +0100)
PR c++/56543
* tree.c (strip_typedefs): Don't copy args if they are NULL.

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

From-SVN: r196491

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

index 76911896908c1c51429b9840fd28cfe7ad01fc8e..8a592345910736c303ddbf33501f4914f77f0eea 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/56543
+       * tree.c (strip_typedefs): Don't copy args if they are NULL.
+
 2013-03-05  Jakub Jelinek  <jakub@redhat.com>
 
        * parser.c (cp_parser_braced_list): For {} initialize
index 75b4d5121ed453acdbc8d8356872b5fffe6ae21e..b57b44ad149d04e38a9f6d6e0557f6cd492f0609 100644 (file)
@@ -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);
index 57df6fc2f3f4884b1dd934570b6ed78d2d5a33e9..d4273c50c105e494d8a584b1db733cef019c75c3 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/56543
+       * g++.dg/template/typename20.C: New test.
+
 2013-03-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/56510
diff --git a/gcc/testsuite/g++.dg/template/typename20.C b/gcc/testsuite/g++.dg/template/typename20.C
new file mode 100644 (file)
index 0000000..d5bd51f
--- /dev/null
@@ -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;
+};