1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00

181735: fix case of failing function resolution

This commit is contained in:
Andrew Ferguson 2007-04-10 10:45:45 +00:00
parent ead2da2599
commit 335151f5f3
2 changed files with 19 additions and 4 deletions

View file

@ -8,6 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Andrew Ferguson (Symbian)
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.ast2;
@ -151,15 +152,18 @@ public class AST2Tests extends AST2BaseTest {
assertNoProblemBindings( col );
}
protected IASTTranslationUnit parseAndCheckBindings( String code ) throws Exception
{
IASTTranslationUnit tu = parse( code, ParserLanguage.C );
protected IASTTranslationUnit parseAndCheckBindings( String code, ParserLanguage lang ) throws Exception {
IASTTranslationUnit tu = parse( code, lang );
CNameCollector col = new CNameCollector();
tu.accept(col);
assertNoProblemBindings( col );
return tu;
}
protected IASTTranslationUnit parseAndCheckBindings( String code ) throws Exception {
return parseAndCheckBindings(code, ParserLanguage.C);
}
public void testBasicFunction() throws Exception {
StringBuffer buff = new StringBuffer();
buff.append("int x;\n"); //$NON-NLS-1$
@ -3623,4 +3627,15 @@ public class AST2Tests extends AST2BaseTest {
assertFalse(lang.toString(), binding instanceof IProblemBinding);
}
}
public void testBug181735() throws Exception {
String code=
"int (*f)(int);\n"
+ "int g(int n) {return n;}\n"
+ "int g(int n, int m) {return n;}\n"
+ "void foo() { f=g; }";
for (int i = 0; i < LANGUAGES.length; i++)
parseAndCheckBindings(code, LANGUAGES[i]);
}
}

View file

@ -2572,7 +2572,7 @@ public class CPPSemantics {
return null;
IASTIdExpression idExp = (IASTIdExpression) name.getParent();
IASTNode node = idExp.getParent();
IASTNode node = idExp;
ASTNodeProperty prop = null;
while( node != null ){
prop = node.getPropertyInParent();