diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index 4d709622fb5..2a290535765 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -2558,5 +2558,22 @@ public class AST2CPPTests extends AST2BaseTest { assertInstances( col, i, 2 ); assertInstances( col, p, 3 ); } + + public void testBug86543() throws Exception { + StringBuffer buffer = new StringBuffer(); + buffer.append("int printf( const char *, ... ); \n"); //$NON-NLS-1$ + buffer.append("void foo(){ \n"); //$NON-NLS-1$ + buffer.append(" int a, b; \n"); //$NON-NLS-1$ + buffer.append(" printf( \"hello\" ); \n"); //$NON-NLS-1$ + buffer.append(" printf(\"a=%d b=%d\", a, b ); \n"); //$NON-NLS-1$ + buffer.append("} \n"); //$NON-NLS-1$ + + IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP); + CPPNameCollector col = new CPPNameCollector(); + tu.getVisitor().visitTranslationUnit(col); + + IFunction printf = (IFunction) col.getName(6).resolveBinding(); + assertInstances( col, printf, 3 ); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java index 246c40a9f7f..d93b1fc0b06 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java @@ -1484,8 +1484,6 @@ public class CPPSemantics { source = getSourceParameterType( sourceParameters, j ); if( source == null ) continue outer; - if( source instanceof IProblemBinding ) - return (IBinding) source; if( j < numTargetParams ){ if( targetLength == 0 && j == 0 ){ @@ -1502,11 +1500,7 @@ public class CPPSemantics { if( varArgs ){ cost = new Cost( source, null ); cost.rank = Cost.ELLIPSIS_CONVERSION; - } /*else if ( target.getHasDefault() && source.isType( ITypeInfo.t_void ) && !source.hasPtrOperators() ){ - //source is just void, ie no parameter, if target had a default, then use that - cost = new Cost( source, target ); - cost.rank = Cost.IDENTITY_RANK; - }*/ else if( source.equals( target ) ){ + } else if( source.equals( target ) ){ cost = new Cost( source, target ); cost.rank = Cost.IDENTITY_RANK; //exact match, no cost } else {