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

Bug 319498: Comparison of unknown bindings.

This commit is contained in:
Markus Schorn 2010-07-20 09:18:54 +00:00
parent cbab1664c5
commit ca93e4ae7e
4 changed files with 12 additions and 6 deletions

View file

@ -975,7 +975,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
// int b;
// func(a, b);
// }
public void _testFunctionTemplate_319498() throws Exception {
public void testFunctionTemplate_319498() throws Exception {
ICPPFunction f= getBindingFromASTName("func(a, b)", 4, ICPPFunction.class);
assertInstance(f, ICPPTemplateInstance.class);
}

View file

@ -1052,7 +1052,9 @@ public class CPPVisitor extends ASTQueries {
if (data != null) {
data.usesEnclosingScope= false;
}
IBinding binding = names[i - 1].resolveBinding();
// For template functions we may need to resolve a template parameter
// as a parent of an unknown type used as parameter type.
IBinding binding = names[i - 1].resolvePreBinding();
while (binding instanceof ITypedef) {
IType t = ((ITypedef) binding).getType();
if (t instanceof IBinding)

View file

@ -80,8 +80,10 @@ class PDOMCPPUnknownClassInstance extends PDOMCPPUnknownClassType implements ICP
if (type instanceof PDOMNode) {
PDOMNode node= (PDOMNode) type;
if (node.getPDOM() == getPDOM()) {
return node.getRecord() == getRecord();
// Different PDOM bindings may result in equal types if a parent
// turns out to be a template parameter.
if (node.getPDOM() == getPDOM() && node.getRecord() == getRecord()) {
return true;
}
}

View file

@ -235,8 +235,10 @@ class PDOMCPPUnknownClassType extends PDOMCPPUnknownBinding implements ICPPClass
if (type instanceof PDOMNode) {
PDOMNode node= (PDOMNode) type;
if (node.getPDOM() == getPDOM()) {
return node.getRecord() == getRecord();
// Different PDOM bindings may result in equal types if a parent
// turns out to be a template parameter.
if (node.getPDOM() == getPDOM() && node.getRecord() == getRecord()) {
return true;
}
}