diff options
author | Nathan Ridge | 2013-05-26 20:24:07 +0000 |
---|---|---|
committer | Sergey Prigogin | 2013-05-26 22:40:25 +0000 |
commit | 2d97fb20b72e858e30ef6239ea215085cb868824 (patch) | |
tree | 45317c8665ff1960c5d8f52374a578eec50308c5 | |
parent | 255cd71f24199f74c3c0c060c5720070ff010bcb (diff) | |
download | org.eclipse.cdt-2d97fb20b72e858e30ef6239ea215085cb868824.tar.gz org.eclipse.cdt-2d97fb20b72e858e30ef6239ea215085cb868824.tar.xz org.eclipse.cdt-2d97fb20b72e858e30ef6239ea215085cb868824.zip |
Bug 409078 - Type resolution failure involving templates and inheritance
Change-Id: I2764c7a6a1121bd35cd8c025388949948eed6e0e
Reviewed-on: https://git.eclipse.org/r/13162
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
2 files changed, 26 insertions, 1 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 163aeebf33c..e41264c9df1 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 @@ -6160,6 +6160,27 @@ public class AST2TemplateTests extends AST2TestBase { parseAndCheckBindings(); } + // template <typename T> + // struct id { + // typedef T type; + // }; + // + // template <typename T> + // struct B { + // struct base : id<id<T>> {}; + // + // typedef typename base::type base2; + // + // struct result : base2 {}; + // }; + // + // typedef B<int>::result::type waldo; + public void testSpecializationOfBaseClass_409078() throws Exception { + BindingAssertionHelper bh = getAssertionHelper(); + ITypedef waldo = bh.assertNonProblem("waldo"); + assertSameType(waldo.getType(), CommonTypes.int_); + } + //struct A { // int m(int i) const; // void m() const; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java index ff98ac89ceb..070c5a6224d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java @@ -155,7 +155,11 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat } if (origClass instanceof IType) { ICPPBase specBase = base.clone(); - IType specClass= CPPTemplates.instantiateType((IType) origClass, tpmap, -1, specialClass, point); + ICPPClassSpecialization specializationContext = specialClass; + if (specialClass.getOwner() instanceof ICPPClassSpecialization) { + specializationContext = (ICPPClassSpecialization) specialClass.getOwner(); + } + IType specClass= CPPTemplates.instantiateType((IType) origClass, tpmap, -1, specializationContext, point); specClass = SemanticUtil.getUltimateType(specClass, false); if (specClass instanceof IBinding && !(specClass instanceof IProblemBinding)) { specBase.setBaseClass((IBinding) specClass); |