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

fix bug 86543

This commit is contained in:
Andrew Niefer 2005-03-01 16:23:03 +00:00
parent 593f2ec013
commit 17879a2974
2 changed files with 18 additions and 7 deletions

View file

@ -2558,5 +2558,22 @@ public class AST2CPPTests extends AST2BaseTest {
assertInstances( col, i, 2 ); assertInstances( col, i, 2 );
assertInstances( col, p, 3 ); 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 );
}
} }

View file

@ -1484,8 +1484,6 @@ public class CPPSemantics {
source = getSourceParameterType( sourceParameters, j ); source = getSourceParameterType( sourceParameters, j );
if( source == null ) if( source == null )
continue outer; continue outer;
if( source instanceof IProblemBinding )
return (IBinding) source;
if( j < numTargetParams ){ if( j < numTargetParams ){
if( targetLength == 0 && j == 0 ){ if( targetLength == 0 && j == 0 ){
@ -1502,11 +1500,7 @@ public class CPPSemantics {
if( varArgs ){ if( varArgs ){
cost = new Cost( source, null ); cost = new Cost( source, null );
cost.rank = Cost.ELLIPSIS_CONVERSION; cost.rank = Cost.ELLIPSIS_CONVERSION;
} /*else if ( target.getHasDefault() && source.isType( ITypeInfo.t_void ) && !source.hasPtrOperators() ){ } else if( source.equals( target ) ){
//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 ) ){
cost = new Cost( source, target ); cost = new Cost( source, target );
cost.rank = Cost.IDENTITY_RANK; //exact match, no cost cost.rank = Cost.IDENTITY_RANK; //exact match, no cost
} else { } else {