aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-06-28 17:06:35 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-06-28 17:06:35 -0400
commitcffc4a68d759fdca588cdf9ece998862b76141e6 (patch)
treea851d0286dacb22b2c1e15d838ea1bccb487325b /gcc/cp/tree.c
parent395a191d0b79c5a42105a8559e4385fb25ee0afd (diff)
downloadgcc-cffc4a68d759fdca588cdf9ece998862b76141e6.zip
gcc-cffc4a68d759fdca588cdf9ece998862b76141e6.tar.gz
gcc-cffc4a68d759fdca588cdf9ece998862b76141e6.tar.bz2
PR c++/72764 - ICE with invalid template typename.
* decl.c (build_typename_type): No longer static. * tree.c (strip_typedefs): Use it instead of make_typename_type. From-SVN: r249760
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index bb17278..4535af6 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1503,13 +1503,13 @@ strip_typedefs (tree t, bool *remove_attributes)
break;
case TYPENAME_TYPE:
{
+ bool changed = false;
tree fullname = TYPENAME_TYPE_FULLNAME (t);
if (TREE_CODE (fullname) == TEMPLATE_ID_EXPR
&& TREE_OPERAND (fullname, 1))
{
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);
@@ -1533,12 +1533,15 @@ strip_typedefs (tree t, bool *remove_attributes)
else
ggc_free (new_args);
}
- result = make_typename_type (strip_typedefs (TYPE_CONTEXT (t),
- remove_attributes),
- fullname, typename_type, tf_none);
- /* Handle 'typedef typename A::N N;' */
- if (typedef_variant_p (result))
- result = TYPE_MAIN_VARIANT (DECL_ORIGINAL_TYPE (TYPE_NAME (result)));
+ tree ctx = strip_typedefs (TYPE_CONTEXT (t), remove_attributes);
+ if (!changed && ctx == TYPE_CONTEXT (t) && !typedef_variant_p (t))
+ return t;
+ tree name = fullname;
+ if (TREE_CODE (fullname) == TEMPLATE_ID_EXPR)
+ name = TREE_OPERAND (fullname, 0);
+ /* Use build_typename_type rather than make_typename_type because we
+ don't want to resolve it here, just strip typedefs. */
+ result = build_typename_type (ctx, name, fullname, typename_type);
}
break;
case DECLTYPE_TYPE: