1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

Bug 422700 - Name resolution problem with variadic template.

This commit is contained in:
Sergey Prigogin 2013-11-27 16:21:54 -08:00
parent 853af1574b
commit a45fabad98
2 changed files with 14 additions and 6 deletions

View file

@ -4999,6 +4999,16 @@ public class AST2TemplateTests extends AST2TestBase {
parseAndCheckBindings(); parseAndCheckBindings();
} }
// template <typename... T>
// struct A {
// static int waldo(T... p, int q);
// };
//
// int x = A<>::waldo(0);
public void testVariadicTemplateWithNoArguments_422700() throws Exception {
parseAndCheckBindings();
}
// struct Test { // struct Test {
// void Update() {} // void Update() {}
// }; // };

View file

@ -43,7 +43,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
@ -602,19 +601,18 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
} }
public static int getRequiredArgumentCount(ICPPParameter[] pars) { public static int getRequiredArgumentCount(ICPPParameter[] pars) {
int result= pars.length; int result = pars.length;
while (result > 0) { for (int i = pars.length; --i >= 0;) {
final ICPPParameter p = pars[result - 1]; final ICPPParameter p = pars[i];
if (p.hasDefaultValue() || p.isParameterPack()) { if (p.hasDefaultValue() || p.isParameterPack()) {
result--; result--;
} else { } else {
if (pars.length == 1 && SemanticUtil.isVoidType(p.getType())) { if (pars.length == 1 && SemanticUtil.isVoidType(p.getType())) {
return 0; return 0;
} }
return result;
} }
} }
return 0; return result;
} }
@Override @Override