mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52: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:
parent
255cd71f24
commit
2d97fb20b7
2 changed files with 26 additions and 1 deletions
|
@ -6160,6 +6160,27 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
parseAndCheckBindings();
|
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 {
|
//struct A {
|
||||||
// int m(int i) const;
|
// int m(int i) const;
|
||||||
// void m() const;
|
// void m() const;
|
||||||
|
|
|
@ -155,7 +155,11 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
|
||||||
}
|
}
|
||||||
if (origClass instanceof IType) {
|
if (origClass instanceof IType) {
|
||||||
ICPPBase specBase = base.clone();
|
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);
|
specClass = SemanticUtil.getUltimateType(specClass, false);
|
||||||
if (specClass instanceof IBinding && !(specClass instanceof IProblemBinding)) {
|
if (specClass instanceof IBinding && !(specClass instanceof IProblemBinding)) {
|
||||||
specBase.setBaseClass((IBinding) specClass);
|
specBase.setBaseClass((IBinding) specClass);
|
||||||
|
|
Loading…
Add table
Reference in a new issue