aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-02-22 17:23:56 -0500
committerJason Merrill <jason@gcc.gnu.org>2013-02-22 17:23:56 -0500
commit5b5d851ea0015765d83b329d93484dcd8ccc8c1e (patch)
treece5dc4e0309d139e8e186cee5d35be9fbf01bb7a /gcc/cp/tree.c
parent18c635651a8f2982c9db6d724e301df4c09739e0 (diff)
downloadgcc-5b5d851ea0015765d83b329d93484dcd8ccc8c1e.zip
gcc-5b5d851ea0015765d83b329d93484dcd8ccc8c1e.tar.gz
gcc-5b5d851ea0015765d83b329d93484dcd8ccc8c1e.tar.bz2
re PR c++/56395 (ICE, Segmentation fault in tsubst)
PR c++/56395 * tree.c (strip_typedefs): Strip typedefs from TYPENAME_TYPE template args. From-SVN: r196228
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 41c8759..75b4d51 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1220,9 +1220,34 @@ strip_typedefs (tree t)
}
break;
case TYPENAME_TYPE:
- result = make_typename_type (strip_typedefs (TYPE_CONTEXT (t)),
- TYPENAME_TYPE_FULLNAME (t),
- typename_type, tf_none);
+ {
+ tree fullname = TYPENAME_TYPE_FULLNAME (t);
+ if (TREE_CODE (fullname) == TEMPLATE_ID_EXPR)
+ {
+ tree args = TREE_OPERAND (fullname, 1);
+ tree new_args = copy_node (args);
+ bool changed = false;
+ for (int i = 0; i < TREE_VEC_LENGTH (args); ++i)
+ {
+ tree arg = TREE_VEC_ELT (args, i);
+ tree strip_arg;
+ if (TYPE_P (arg))
+ strip_arg = strip_typedefs (arg);
+ else
+ strip_arg = strip_typedefs_expr (arg);
+ TREE_VEC_ELT (new_args, i) = strip_arg;
+ if (strip_arg != arg)
+ changed = true;
+ }
+ if (changed)
+ fullname = lookup_template_function (TREE_OPERAND (fullname, 0),
+ new_args);
+ else
+ ggc_free (new_args);
+ }
+ result = make_typename_type (strip_typedefs (TYPE_CONTEXT (t)),
+ fullname, typename_type, tf_none);
+ }
break;
case DECLTYPE_TYPE:
result = strip_typedefs_expr (DECLTYPE_TYPE_EXPR (t));