1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

Bug 540538 - Pack size for CPPTemplateParameter

Change-Id: Ie67f27711ca658e9b4b3526c5c3c28541dcd3a15
Signed-off-by: Hannes Vogt <hannes@havogt.de>
This commit is contained in:
Hannes Vogt 2018-10-28 19:56:04 +01:00 committed by Nathan Ridge
parent 1cbe7e32b9
commit 8404a76e6e
2 changed files with 19 additions and 1 deletions

View file

@ -10954,4 +10954,18 @@ public class AST2TemplateTests extends AST2CPPTestBase {
IType waldo = helper.assertNonProblem("waldo");
assertSameType(SemanticUtil.getSimplifiedType(waldo), CommonCPPTypes.int_);
}
// template <bool...>
// struct list {};
//
// template <class... Ts>
// using foo = list<Ts::value...>;
//
// template<class T> struct trigger{};
//
// template <class T>
// using evaluate = trigger<foo<T>>;
public void testNonTypePackExpansion_540538() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -50,6 +50,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
import org.eclipse.cdt.internal.core.dom.parser.DependentValue;
@ -481,7 +482,10 @@ public class EvalID extends CPPDependentEvaluation {
@Override
public int determinePackSize(ICPPTemplateParameterMap tpMap) {
int r = fFieldOwner != null ? fFieldOwner.determinePackSize(tpMap) : CPPTemplates.PACK_SIZE_NOT_FOUND;
if (fNameOwner instanceof ICPPUnknownBinding) {
if (fNameOwner instanceof ICPPTemplateParameter) {
r = CPPTemplates.combinePackSize(r, CPPTemplates.determinePackSize((ICPPTemplateParameter) fNameOwner, tpMap));
}
else if (fNameOwner instanceof ICPPUnknownBinding) {
r = CPPTemplates.combinePackSize(r, CPPTemplates.determinePackSize((ICPPUnknownBinding) fNameOwner, tpMap));
}
if (fTemplateArgs != null) {