1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

fix bug 43241

This commit is contained in:
Andrew Niefer 2005-07-12 18:49:19 +00:00
parent 83312c621f
commit f9413dc151
2 changed files with 17 additions and 11 deletions

View file

@ -89,9 +89,9 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
*/
public class AST2Tests extends AST2BaseTest {
// public void testBug43241() throws Exception {
// parseAndCheckBindings( "int m(int); int (*pm)(int) = &m; int f(){} int f(int); int x = f((*pm)(5));" ); //$NON-NLS-1$
// }
public void testBug43241() throws Exception {
parseAndCheckBindings( "int m(int); int (*pm)(int) = &m; int f(int); int x = f((*pm)(5));" ); //$NON-NLS-1$
}
public void testBug40768() throws Exception {
StringBuffer buffer = new StringBuffer( "int *zzz1 (char);\n" ); //$NON-NLS-1$

View file

@ -250,11 +250,16 @@ public class CFunction implements IFunction, ICInternalFunction {
IASTParameterDeclaration temp = null;
if( definition != null ){
if( definition instanceof IASTStandardFunctionDeclarator ){
temp = ((IASTStandardFunctionDeclarator)definition).getParameters()[idx];
IASTParameterDeclaration [] parameters = ((IASTStandardFunctionDeclarator)definition).getParameters();
if( parameters.length > idx ) {
temp = parameters[idx];
temp.getDeclarator().getName().setBinding( binding );
}
} else if( definition instanceof ICASTKnRFunctionDeclarator ){
fKnRDtor = (ICASTKnRFunctionDeclarator) definition;
IASTName n = fKnRDtor.getParameterNames()[idx];
IASTName [] parameterNames = fKnRDtor.getParameterNames();
if( parameterNames.length > idx ) {
IASTName n = parameterNames[idx];
n.setBinding( binding );
IASTDeclarator dtor = CVisitor.getKnRParameterDeclarator( fKnRDtor, n );
if( dtor != null ){
@ -262,6 +267,7 @@ public class CFunction implements IFunction, ICInternalFunction {
}
}
}
}
if( declarators != null ){
for( int j = 0; j < declarators.length && declarators[j] != null; j++ ){
if( declarators[j].getParameters().length > idx ){