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 + // struct id { + // typedef T type; + // }; + // + // template + // struct B { + // struct base : id> {}; + // + // typedef typename base::type base2; + // + // struct result : base2 {}; + // }; + // + // typedef B::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);