Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2013-09-04 17:39:47 -0400
committerSergey Prigogin2013-09-10 23:24:09 -0400
commit22078c723dc15fe30a8111b0c833cee1422e5bc9 (patch)
treeaadcb8a87705be3f25c625cc9ab50f0f1fa31722
parent4e81f0fce230ff6a67fe1427a884cbd3a8340707 (diff)
downloadorg.eclipse.cdt-22078c723dc15fe30a8111b0c833cee1422e5bc9.tar.gz
org.eclipse.cdt-22078c723dc15fe30a8111b0c833cee1422e5bc9.tar.xz
org.eclipse.cdt-22078c723dc15fe30a8111b0c833cee1422e5bc9.zip
Bug 416280 - Name resolution problem with alias template.
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java16
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java5
2 files changed, 21 insertions, 0 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 fd7bcba9dd..d0823a4593 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
@@ -7082,6 +7082,22 @@ public class AST2TemplateTests extends AST2TestBase {
parseAndCheckBindings();
}
+ // template<typename T>
+ // struct A {};
+ //
+ // template<typename T>
+ // using B = A<T>;
+ //
+ // template<typename T>
+ // void f(B<T>* p);
+ //
+ // void test(A<int>* c) {
+ // f(c);
+ // }
+ public void testAliasTemplate_416280() throws Exception {
+ parseAndCheckBindings();
+ }
+
// template<typename U>
// struct A {
// typedef U type1;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java
index fa1f084246..6e1104260a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java
@@ -292,6 +292,9 @@ public class TemplateArgumentDeduction {
}
}
}
+ while (pcheck instanceof ITypedef)
+ pcheck = ((ITypedef) pcheck).getType();
+
if (pcheck instanceof ICPPTemplateInstance && argcheck instanceof ICPPClassType) {
ICPPTemplateInstance pInst = (ICPPTemplateInstance) pcheck;
ICPPClassTemplate pTemplate= getPrimaryTemplate(pInst);
@@ -830,6 +833,8 @@ public class TemplateArgumentDeduction {
IType argumentTypeBeforeTypedefResolution = a;
while (a instanceof ITypedef)
a = ((ITypedef) a).getType();
+ while (p instanceof ITypedef)
+ p = ((ITypedef) p).getType();
if (p instanceof IBasicType) {
return p.isSameType(a);
} else if (p instanceof ICPPPointerToMemberType) {

Back to the top