mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-03 14:25:37 +02:00
Bug 422700 - Name resolution problem with variadic template.
This commit is contained in:
parent
853af1574b
commit
a45fabad98
2 changed files with 14 additions and 6 deletions
|
@ -4999,6 +4999,16 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
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 {
|
||||
// void Update() {}
|
||||
// };
|
||||
|
|
|
@ -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.ICPPASTFunctionDefinition;
|
||||
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.ICPPClassScope;
|
||||
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) {
|
||||
int result= pars.length;
|
||||
while (result > 0) {
|
||||
final ICPPParameter p = pars[result - 1];
|
||||
int result = pars.length;
|
||||
for (int i = pars.length; --i >= 0;) {
|
||||
final ICPPParameter p = pars[i];
|
||||
if (p.hasDefaultValue() || p.isParameterPack()) {
|
||||
result--;
|
||||
} else {
|
||||
if (pars.length == 1 && SemanticUtil.isVoidType(p.getType())) {
|
||||
return 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue