1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

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>
This commit is contained in:
Nathan Ridge 2013-05-26 16:24:07 -04:00 committed by Sergey Prigogin
parent 255cd71f24
commit 2d97fb20b7
2 changed files with 26 additions and 1 deletions

View file

@ -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;

View file

@ -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);