Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorNathan Ridge2018-09-15 23:33:08 -0400
committerNathan Ridge2018-09-24 21:23:23 -0400
commit732c4874ee94ec65bd90b12d44f55d57585471bb (patch)
treed6386fa6b5b55ec4dc33c857bdc464cb52e5f9e1 /core
parente2e9325bb45f3f95838e32e07f58091fb19046c4 (diff)
downloadorg.eclipse.cdt-732c4874ee94ec65bd90b12d44f55d57585471bb.tar.gz
org.eclipse.cdt-732c4874ee94ec65bd90b12d44f55d57585471bb.tar.xz
org.eclipse.cdt-732c4874ee94ec65bd90b12d44f55d57585471bb.zip
Bug 539076 - Substitution of alias template for template template parameter
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java12
2 files changed, 29 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
index 48a9cd6539..96af705566 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
@@ -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_);
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
index 56f7c837cd..89c30f2a77 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
@@ -3113,9 +3113,15 @@ public class CPPTemplates {
boolean changed= arguments != newArgs;
IType classTemplateSpecialization= instantiateType(classTemplate, context);
- if (classTemplateSpecialization != classTemplate && classTemplateSpecialization instanceof ICPPClassTemplate) {
- classTemplate= (ICPPClassTemplate) classTemplateSpecialization;
- changed= true;
+ 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) {

Back to the top