mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Fixes a NPE, bug 244384.
This commit is contained in:
parent
35c7928f5e
commit
63563deaf8
1 changed files with 20 additions and 24 deletions
|
@ -1696,21 +1696,18 @@ public class CPPTemplates {
|
||||||
// Using the transformed parameter list, perform argument deduction against the other
|
// Using the transformed parameter list, perform argument deduction against the other
|
||||||
// function template
|
// function template
|
||||||
ObjectMap m1 = null;
|
ObjectMap m1 = null;
|
||||||
if (f1 != null) {
|
ObjectMap m2 = null;
|
||||||
|
|
||||||
IType[] args = createArgsForFunctionTemplateOrdering(f1);
|
IType[] args = createArgsForFunctionTemplateOrdering(f1);
|
||||||
IBinding function = instantiate(f1, args);
|
IBinding function = instantiate(f1, args);
|
||||||
if (function instanceof ICPPFunction)
|
if (function instanceof ICPPFunction)
|
||||||
m1 = deduceTemplateArguments(f2, ((ICPPFunction) function).getType().getParameterTypes());
|
m1 = deduceTemplateArguments(f2, ((ICPPFunction) function).getType().getParameterTypes());
|
||||||
}
|
|
||||||
|
|
||||||
ObjectMap m2 = null;
|
|
||||||
if (f2 != null) {
|
|
||||||
IType[] args = createArgsForFunctionTemplateOrdering(f2);
|
|
||||||
IBinding function = instantiate(f2, args);
|
|
||||||
|
|
||||||
|
args = createArgsForFunctionTemplateOrdering(f2);
|
||||||
|
function = instantiate(f2, args);
|
||||||
if (function instanceof ICPPFunction)
|
if (function instanceof ICPPFunction)
|
||||||
m2 = deduceTemplateArguments(f1, ((ICPPFunction) function).getType().getParameterTypes());
|
m2 = deduceTemplateArguments(f1, ((ICPPFunction) function).getType().getParameterTypes());
|
||||||
}
|
|
||||||
// The transformed template is at least as specialized as the other iff the deduction
|
// The transformed template is at least as specialized as the other iff the deduction
|
||||||
// succeeds and the deduced parameter types are an exact match.
|
// succeeds and the deduced parameter types are an exact match.
|
||||||
// A template is more specialized than another iff it is at least as specialized as the
|
// A template is more specialized than another iff it is at least as specialized as the
|
||||||
|
@ -1802,16 +1799,15 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
//to order class template specializations, we need to transform them into function templates
|
//to order class template specializations, we need to transform them into function templates
|
||||||
ICPPFunctionTemplate template1 = null, template2 = null;
|
ICPPFunctionTemplate template1 = classTemplateSpecializationToFunctionTemplate(spec1);
|
||||||
|
ICPPFunctionTemplate template2 = classTemplateSpecializationToFunctionTemplate(spec2);
|
||||||
// if (spec1 instanceof ICPPClassType) {
|
if (template1 == null) {
|
||||||
template1 = classTemplateSpecializationToFunctionTemplate(spec1);
|
if (template2 == null)
|
||||||
template2 = classTemplateSpecializationToFunctionTemplate(spec2);
|
return 0;
|
||||||
// }
|
return 1;
|
||||||
// else if (spec1 instanceof ICPPFunction) {
|
}
|
||||||
// template1 = (ICPPFunctionTemplate) spec1;
|
if (template2 == null)
|
||||||
// template2 = (ICPPFunctionTemplate) spec2;
|
return -1;
|
||||||
// }
|
|
||||||
|
|
||||||
return orderTemplateFunctions(template1, template2);
|
return orderTemplateFunctions(template1, template2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue