1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

fix bug 86766

This commit is contained in:
Andrew Niefer 2005-03-01 17:59:54 +00:00
parent 7591bd643e
commit 145891c763
2 changed files with 19 additions and 2 deletions

View file

@ -2941,4 +2941,15 @@ public class AST2Tests extends AST2BaseTest {
ICPPASTCastExpression.op_dynamic_cast);
}
public void testBug86766() throws Exception {
IASTTranslationUnit tu = parse("char foo; void foo(){}", ParserLanguage.C); //$NON-NLS-1$
CNameCollector col = new CNameCollector();
tu.getVisitor().visitTranslationUnit( col);
IVariable foo = (IVariable) col.getName(0).resolveBinding();
IProblemBinding prob = (IProblemBinding) col.getName(1).resolveBinding();
assertEquals( prob.getID(), IProblemBinding.SEMANTIC_INVALID_OVERLOAD );
assertNotNull( foo );
}
}

View file

@ -640,7 +640,10 @@ public class CVisitor implements ICASTVisitor {
if( declarator instanceof IASTStandardFunctionDeclarator ){
binding = resolveBinding( parent, CURRENT_SCOPE );
if( binding != null ) {
((CFunction)binding).addDeclarator( (IASTStandardFunctionDeclarator) declarator );
if( binding instanceof IFunction )
((CFunction)binding).addDeclarator( (IASTStandardFunctionDeclarator) declarator );
else
binding = new ProblemBinding( IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
} else {
binding = createBinding(declarator);
}
@ -648,7 +651,10 @@ public class CVisitor implements ICASTVisitor {
if ( CharArrayUtils.equals(declarator.getName().toCharArray(), name.toCharArray()) ){
binding = resolveBinding( parent, CURRENT_SCOPE );
if( binding != null ) {
((CFunction)binding).addDeclarator( (ICASTKnRFunctionDeclarator) declarator );
if( binding instanceof IFunction )
((CFunction)binding).addDeclarator( (ICASTKnRFunctionDeclarator) declarator );
else
binding = new ProblemBinding( IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
} else {
binding = createBinding(declarator);
}