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 class AST2Tests extends AST2BaseTest {
// public void testBug43241() throws Exception { 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$ parseAndCheckBindings( "int m(int); int (*pm)(int) = &m; int f(int); int x = f((*pm)(5));" ); //$NON-NLS-1$
// } }
public void testBug40768() throws Exception { public void testBug40768() throws Exception {
StringBuffer buffer = new StringBuffer( "int *zzz1 (char);\n" ); //$NON-NLS-1$ StringBuffer buffer = new StringBuffer( "int *zzz1 (char);\n" ); //$NON-NLS-1$

View file

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