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:
parent
e2e9325bb4
commit
732c4874ee
2 changed files with 29 additions and 3 deletions
|
@ -10934,4 +10934,24 @@ public class AST2TemplateTests extends AST2CPPTestBase {
|
||||||
public void testMetaprogrammingWithAliasTemplates_534126() throws Exception {
|
public void testMetaprogrammingWithAliasTemplates_534126() throws Exception {
|
||||||
parseAndCheckBindings();
|
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_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3113,9 +3113,15 @@ public class CPPTemplates {
|
||||||
|
|
||||||
boolean changed= arguments != newArgs;
|
boolean changed= arguments != newArgs;
|
||||||
IType classTemplateSpecialization= instantiateType(classTemplate, context);
|
IType classTemplateSpecialization= instantiateType(classTemplate, context);
|
||||||
if (classTemplateSpecialization != classTemplate && classTemplateSpecialization instanceof ICPPClassTemplate) {
|
if (classTemplateSpecialization != classTemplate) {
|
||||||
classTemplate= (ICPPClassTemplate) classTemplateSpecialization;
|
if (classTemplateSpecialization instanceof ICPPClassTemplate) {
|
||||||
changed= true;
|
classTemplate= (ICPPClassTemplate) classTemplateSpecialization;
|
||||||
|
changed= true;
|
||||||
|
} else if (classTemplateSpecialization instanceof ICPPAliasTemplate) {
|
||||||
|
IBinding inst = instantiateAliasTemplate((ICPPAliasTemplate) classTemplateSpecialization, newArgs);
|
||||||
|
if (inst != null)
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue