From 46903cc52fabe649f039afe3ef0419e68a5e0a92 Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Fri, 17 Nov 2006 15:59:44 +0000 Subject: [PATCH] Bug 164972 - Fix handling when f(void) is used in a decl and f() in the def. --- .../internal/core/dom/parser/cpp/CPPFunction.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java index e59f9ae3b58..3e8f1bb410c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java @@ -368,11 +368,14 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt binding = new CPPParameter( name ); IASTParameterDeclaration temp = null; if( definition != null ){ - temp = definition.getParameters()[i]; - IASTName n = temp.getDeclarator().getName(); - if( n != name ) { - n.setBinding( binding ); - ((CPPParameter)binding).addDeclaration( n ); + IASTParameterDeclaration[] paramDecls = definition.getParameters(); + if (paramDecls.length > i) { // This will be less than i if we have a void parameter + temp = paramDecls[i]; + IASTName n = temp.getDeclarator().getName(); + if( n != name ) { + n.setBinding( binding ); + ((CPPParameter)binding).addDeclaration( n ); + } } } if( declarations != null ){