From f721770c5ef696c48b7cfe27e811ae2d85b67189 Mon Sep 17 00:00:00 2001 From: Doug Schaefer Date: Thu, 25 May 2006 03:24:38 +0000 Subject: [PATCH] Bug 142713 - For some reason the number of template parameters in this code was smaller than expected. Could be due to some unimplemented methods in the PDOM, but I'm not sure of that. At any rate, I've added a check to skip over the tempate if the number of parameters wasn't large enough. --- .../core/dom/parser/cpp/CPPTemplateDefinition.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateDefinition.java index d7dbaed802c..84a6ad2c209 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateDefinition.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateDefinition.java @@ -199,18 +199,20 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC else binding = new CPPTemplateTemplateParameter( name ); - ICPPASTTemplateParameter temp = null; - ICPPASTTemplateDeclaration template = null; int length = ( declarations != null ) ? declarations.length : 0; int j = ( definition != null ) ? -1 : 0; for( ; j < length; j++ ){ - template = ( j == -1 ) ? CPPTemplates.getTemplateDeclaration( definition ) - : CPPTemplates.getTemplateDeclaration( declarations[j] ); + ICPPASTTemplateDeclaration template = ( j == -1 ) + ? CPPTemplates.getTemplateDeclaration( definition ) + : CPPTemplates.getTemplateDeclaration( declarations[j] ); if( template == null ) continue; - temp = template.getTemplateParameters()[i]; + + ICPPASTTemplateParameter[] temp = template.getTemplateParameters(); + if (temp.length <= i) + continue; - IASTName n = CPPTemplates.getTemplateParameterName( temp ); + IASTName n = CPPTemplates.getTemplateParameterName(temp[i]); if( n != null && n != name && n.getBinding() == null ) { n.setBinding( binding ); if( binding instanceof ICPPInternalBinding )