1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Using partial specializations and explicit class template instantiations from index, bug 180738.

This commit is contained in:
Markus Schorn 2008-11-14 14:45:39 +00:00
parent 6225f6b14f
commit 8825fd6135
2 changed files with 14 additions and 14 deletions

View file

@ -524,7 +524,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
// class D<B, T3> {};
// template<typename T3>
// class D<C, T3> {};
public void _testClassPartialSpecializations() throws Exception {
public void testClassPartialSpecializations() throws Exception {
IBinding b0= getBindingFromASTName("D<A, T3>", 8);
IBinding b1= getBindingFromASTName("D<B, T3>", 8);
IBinding b2= getBindingFromASTName("D<C, T3>", 8);
@ -919,7 +919,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
// class Foo<A> {};
//
// Foo<B> b2;
public void _testClassSpecializations_180738() {
public void testClassSpecializations_180738() {
IBinding b1a = getBindingFromASTName("Foo<B> b1;", 3);
IBinding b1b = getBindingFromASTName("Foo<B> b1;", 6);

View file

@ -1563,9 +1563,8 @@ public class CPPSemantics {
return null;
// specialization is selected during instantiation
// mstodo why not?
// if (candidate instanceof ICPPTemplateInstance && candidate instanceof IType)
// candidate= ((ICPPTemplateInstance) candidate).getSpecializedBinding();
if (candidate instanceof ICPPTemplateInstance && candidate instanceof IType)
candidate= ((ICPPTemplateInstance) candidate).getSpecializedBinding();
return candidate;
}
@ -1720,11 +1719,6 @@ public class CPPSemantics {
continue;
}
// specialization is selected during instantiation
// mstodo why not?
// if (temp instanceof ICPPTemplateInstance && temp instanceof IType)
// temp= ((ICPPTemplateInstance) temp).getSpecializedBinding();
// select among those bindings that have been created without problems.
if (temp instanceof IProblemBinding)
continue;
@ -1764,12 +1758,18 @@ public class CPPSemantics {
}
}
} else if (temp instanceof IType) {
// specializations are selected during instantiation
if (temp instanceof ICPPClassTemplatePartialSpecialization)
continue;
if (temp instanceof ICPPTemplateInstance) {
temp= ((ICPPTemplateInstance) temp).getSpecializedBinding();
if (!(temp instanceof IType))
continue;
}
if (type == null) {
type = temp;
} else if (type instanceof ICPPClassTemplate && temp instanceof ICPPSpecialization &&
((IType) type).isSameType((IType) ((ICPPSpecialization)temp).getSpecializedBinding())) {
// ok, stay with the template, the specialization, if applicable, will come out during instantiation
} else if (type != temp && !((IType)type).isSameType((IType) temp)) {
} else if (type != temp && !((IType)type).isSameType((IType) temp)) {
return new ProblemBinding(data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name());
}
} else {