diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java index 401c22710e1..ca054f6697d 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java @@ -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$ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunction.java index 0aef1324db5..d7eef03fc2e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunction.java @@ -250,16 +250,22 @@ public class CFunction implements IFunction, ICInternalFunction { IASTParameterDeclaration temp = null; if( definition != null ){ if( definition instanceof IASTStandardFunctionDeclarator ){ - temp = ((IASTStandardFunctionDeclarator)definition).getParameters()[idx]; - temp.getDeclarator().getName().setBinding( binding ); + 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]; - n.setBinding( binding ); - IASTDeclarator dtor = CVisitor.getKnRParameterDeclarator( fKnRDtor, n ); - if( dtor != null ){ - dtor.getName().setBinding( binding ); - } + IASTName [] parameterNames = fKnRDtor.getParameterNames(); + if( parameterNames.length > idx ) { + IASTName n = parameterNames[idx]; + n.setBinding( binding ); + IASTDeclarator dtor = CVisitor.getKnRParameterDeclarator( fKnRDtor, n ); + if( dtor != null ){ + dtor.getName().setBinding( binding ); + } + } } } if( declarators != null ){