diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplate.java index 03469779805..a95af205137 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplate.java @@ -163,18 +163,19 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition if (fdecl != null) { IASTParameterDeclaration[] params = fdecl.getParameters(); int size = params.length; + if (size == 0) { + return ICPPParameter.EMPTY_CPPPARAMETER_ARRAY; + } ICPPParameter[] result = new ICPPParameter[size]; - if (size > 0) { - for(int i = 0; i < size; i++) { - IASTParameterDeclaration p = params[i]; - final IASTName pname = ASTQueries.findInnermostDeclarator(p.getDeclarator()).getName(); - final IBinding binding= pname.resolveBinding(); - if (binding instanceof ICPPParameter) { - result[i]= (ICPPParameter) binding; - } else { - result[i] = new CPPParameter.CPPParameterProblem(p, - IProblemBinding.SEMANTIC_INVALID_TYPE, pname.toCharArray()); - } + for (int i = 0; i < size; i++) { + IASTParameterDeclaration p = params[i]; + final IASTName pname = ASTQueries.findInnermostDeclarator(p.getDeclarator()).getName(); + final IBinding binding= pname.resolveBinding(); + if (binding instanceof ICPPParameter) { + result[i]= (ICPPParameter) binding; + } else { + result[i] = new CPPParameter.CPPParameterProblem(p, + IProblemBinding.SEMANTIC_INVALID_TYPE, pname.toCharArray()); } } return result; @@ -182,7 +183,6 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition return CPPBuiltinParameter.createParameterList(getType()); } - public int getRequiredArgumentCount() throws DOMException { return CPPFunction.getRequiredArgumentCount(getParameters()); } @@ -200,9 +200,9 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition if (type == null) { IASTName name = getTemplateName(); IASTNode parent = name.getParent(); - while(parent.getParent() instanceof IASTDeclarator) + while (parent.getParent() instanceof IASTDeclarator) parent = parent.getParent(); - + IType temp = getNestedType(CPPVisitor.createType((IASTDeclarator)parent), TDEF); if (temp instanceof ICPPFunctionType) type = (ICPPFunctionType) temp; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java index 3c08253fd8e..6a1d2bafdd4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java @@ -171,7 +171,7 @@ public class TemplateArgumentDeduction { par= fnPars[j]; if (par instanceof ICPPParameterPackType) { // must be the last parameter. - if (j != fnParCount-1) + if (j != fnParCount - 1) return false; par= fnParPack= ((ICPPParameterPackType) par).getType(); @@ -193,7 +193,7 @@ public class TemplateArgumentDeduction { // 14.8.2.1-2 if (par instanceof ICPPReferenceType) { // If P is an rvalue reference to a cv-unqualified template parameter and the argument is an - // lvalue, the type A& “lvalue reference to A” is used in place of A for type deduction. + // lvalue, the type A& �lvalue reference to A� is used in place of A for type deduction. isReferenceTypeParameter= true; final ICPPReferenceType refPar = (ICPPReferenceType) par; if (refPar.isRValueReference() && refPar.getType() instanceof ICPPTemplateParameter && argIsLValue.get(j)) { @@ -290,7 +290,6 @@ public class TemplateArgumentDeduction { return null; } - private static ICPPClassTemplate getPrimaryTemplate(ICPPTemplateInstance inst) throws DOMException { ICPPTemplateDefinition template= inst.getTemplateDefinition(); if (template instanceof ICPPClassTemplatePartialSpecialization) { @@ -328,7 +327,6 @@ public class TemplateArgumentDeduction { return result; } - /** * Deduces the template parameter mapping from pairs of template arguments. */ @@ -338,7 +336,7 @@ public class TemplateArgumentDeduction { if (p == null || p.length != len) { return false; } - for (int j=0; j