summaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 5960e4624b6..50080b0947a 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -4749,6 +4749,11 @@ push_template_decl_real (tree decl, bool is_friend)
else if (DECL_IMPLICIT_TYPEDEF_P (decl)
&& CLASS_TYPE_P (TREE_TYPE (decl)))
/* OK */;
+ else if (TREE_CODE (decl) == TYPE_DECL)
+ {
+ /* alias-declaration */
+ gcc_assert (!DECL_ARTIFICIAL (decl));
+ }
else
{
error ("template declaration of %q#D", decl);
@@ -5013,8 +5018,13 @@ template arguments to %qD do not match original template %qD",
if (DECL_IMPLICIT_TYPEDEF_P (decl))
SET_TYPE_TEMPLATE_INFO (TREE_TYPE (tmpl), info);
- else if (DECL_LANG_SPECIFIC (decl))
- DECL_TEMPLATE_INFO (decl) = info;
+ else
+ {
+ if (primary && !DECL_LANG_SPECIFIC (decl))
+ retrofit_lang_decl (decl);
+ if (DECL_LANG_SPECIFIC (decl))
+ DECL_TEMPLATE_INFO (decl) = info;
+ }
return DECL_TEMPLATE_RESULT (tmpl);
}
@@ -7001,7 +7011,7 @@ lookup_template_class (tree d1,
ENUM_FIXED_UNDERLYING_TYPE_P (t)
= ENUM_FIXED_UNDERLYING_TYPE_P (template_type);
}
- else
+ else if (CLASS_TYPE_P (template_type))
{
t = make_class_type (TREE_CODE (template_type));
CLASSTYPE_DECLARED_CLASS (t)
@@ -7024,6 +7034,13 @@ lookup_template_class (tree d1,
structural equality testing. */
SET_TYPE_STRUCTURAL_EQUALITY (t);
}
+ else
+ {
+ /* A template alias. */
+ type_decl = tsubst (DECL_TEMPLATE_RESULT (templ), arglist,
+ complain, in_decl);
+ t = TREE_TYPE (type_decl);
+ }
/* If we called start_enum or pushtag above, this information
will already be set up. */