1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Bug 539076 - Substitution of alias template for template template parameter

Change-Id: Ide5a6858560b0aae1efd391215bc229bef5421e7
This commit is contained in:
Nathan Ridge 2018-09-15 23:33:08 -04:00
parent e2e9325bb4
commit 732c4874ee
2 changed files with 29 additions and 3 deletions

View file

@ -10934,4 +10934,24 @@ public class AST2TemplateTests extends AST2CPPTestBase {
public void testMetaprogrammingWithAliasTemplates_534126() throws Exception {
parseAndCheckBindings();
}
// template <class>
// struct hhh {
// using type = int;
// };
//
// template <template <class> class TT>
// struct iii {
// using type = typename TT<int>::type;
// };
//
// template <class A>
// using hhh_d = hhh<A>;
//
// using waldo = typename iii<hhh_d>::type;
public void testAliasTemplateAsTemplateTemplateArg_539076() throws Exception {
BindingAssertionHelper helper = getAssertionHelper();
IType waldo = helper.assertNonProblem("waldo");
assertSameType(SemanticUtil.getSimplifiedType(waldo), CommonCPPTypes.int_);
}
}

View file

@ -3113,9 +3113,15 @@ public class CPPTemplates {
boolean changed= arguments != newArgs;
IType classTemplateSpecialization= instantiateType(classTemplate, context);
if (classTemplateSpecialization != classTemplate && classTemplateSpecialization instanceof ICPPClassTemplate) {
if (classTemplateSpecialization != classTemplate) {
if (classTemplateSpecialization instanceof ICPPClassTemplate) {
classTemplate= (ICPPClassTemplate) classTemplateSpecialization;
changed= true;
} else if (classTemplateSpecialization instanceof ICPPAliasTemplate) {
IBinding inst = instantiateAliasTemplate((ICPPAliasTemplate) classTemplateSpecialization, newArgs);
if (inst != null)
return inst;
}
}
if (changed) {