OSDN Git Service

PR debug/56819
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Apr 2013 19:44:02 +0000 (19:44 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Apr 2013 19:44:02 +0000 (19:44 +0000)
* tree.c (strip_typedefs): Copy NON_DEFAULT_TEMPLATE_ARGS_COUNT
from args to new_args.
(strip_typedefs_expr): Copy NON_DEFAULT_TEMPLATE_ARGS_COUNT from t to
r instead of doing {S,G}ET_NON_DEFAULT_TEMPLATE_ARGS_COUNT.

* g++.dg/debug/pr56819.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@197454 138bc75d-0d04-0410-961f-82ee72b054a4

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

index bd0368b..1194e9a 100644 (file)
@@ -1,3 +1,11 @@
+2013-04-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/56819
+       * tree.c (strip_typedefs): Copy NON_DEFAULT_TEMPLATE_ARGS_COUNT
+       from args to new_args.
+       (strip_typedefs_expr): Copy NON_DEFAULT_TEMPLATE_ARGS_COUNT from t to
+       r instead of doing {S,G}ET_NON_DEFAULT_TEMPLATE_ARGS_COUNT.
+
 2013-04-01  Jason Merrill  <jason@redhat.com>
 
        PR c++/56794
index b4a5386..f5a4385 100644 (file)
@@ -1229,8 +1229,13 @@ strip_typedefs (tree t)
                  changed = true;
              }
            if (changed)
-             fullname = lookup_template_function (TREE_OPERAND (fullname, 0),
-                                                  new_args);
+             {
+               NON_DEFAULT_TEMPLATE_ARGS_COUNT (new_args)
+                 = NON_DEFAULT_TEMPLATE_ARGS_COUNT (args);
+               fullname
+                 = lookup_template_function (TREE_OPERAND (fullname, 0),
+                                             new_args);
+             }
            else
              ggc_free (new_args);
          }
@@ -1363,8 +1368,8 @@ strip_typedefs_expr (tree t)
            r = copy_node (t);
            for (i = 0; i < n; ++i)
              TREE_VEC_ELT (r, i) = VEC_index (tree, vec, i);
-           SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT
-             (r, GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (t));
+           NON_DEFAULT_TEMPLATE_ARGS_COUNT (r)
+             = NON_DEFAULT_TEMPLATE_ARGS_COUNT (t);
          }
        else
          r = t;
index 461a7b6..27b507c 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/56819
+       * g++.dg/debug/pr56819.C: New test.
+
 2013-04-03  Tobias Burnus  <burnus@net-b.de>
 
        Backport from mainline:
diff --git a/gcc/testsuite/g++.dg/debug/pr56819.C b/gcc/testsuite/g++.dg/debug/pr56819.C
new file mode 100644 (file)
index 0000000..62926be
--- /dev/null
@@ -0,0 +1,27 @@
+// PR debug/56819
+// { dg-do compile }
+// { dg-options "-fcompare-debug" }
+
+template <typename>
+struct A
+{
+  template <typename>
+  struct B;
+};
+
+template <typename>
+struct C
+{
+  typedef int I;
+};
+
+template <typename T>
+class D
+{
+  typedef A <void> E;
+  typedef typename T::template B <E> F;
+  typedef typename C <F>::I I;
+  A <I> foo () { return A<I> (); }
+};
+
+template class D <A <void> >;