1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Bug 508254 - Gracefully handle ProblemBinding arising during instantiation of EvalConstructor

Change-Id: Ib5c5ce10e32cb0e7b42ccf0283709295da311931
This commit is contained in:
Nathan Ridge 2016-12-17 02:16:41 -05:00
parent 94f4b03a06
commit 3f8b3f0870
2 changed files with 28 additions and 1 deletions

View file

@ -187,4 +187,27 @@ public class IndexMultiFileTest extends IndexBindingResolutionTestBase {
public void testClassTemplatePartialSpecialization_470726() throws Exception {
checkBindings();
}
// test.h
// template <bool = false>
// struct base {};
//
// template <bool B = false>
// struct derived : private base<B> {
// constexpr derived() : base<B>() {}
// };
// test1.cpp
// #include "test.h"
// test2.cpp *
// template <typename = void>
// struct base {};
//
// static derived<> waldo;
public void testProblemBindingInMemInitList_508254() throws Exception {
// This code is invalid, so we don't checkBindings().
// If the test gets this far (doesn't throw in setup() during indexing), it passes.
}
}

View file

@ -134,7 +134,11 @@ public final class EvalConstructor extends CPPDependentEvaluation {
@Override
public ICPPEvaluation computeForFunctionCall(ActivationRecord callSiteRecord, ConstexprEvaluationContext context) {
final ICPPClassType classType = (ICPPClassType) SemanticUtil.getNestedType(fType, TDEF | REF | CVTYPE);
final IType unwrappedType = SemanticUtil.getNestedType(fType, TDEF | REF | CVTYPE);
if (!(unwrappedType instanceof ICPPClassType)) {
return this;
}
final ICPPClassType classType = (ICPPClassType) unwrappedType;
final CompositeValue compositeValue = CompositeValue.create(classType);
ICPPEvaluation[] argList = evaluateArguments(fArguments, callSiteRecord, context);
EvalFixed constructedObject = new EvalFixed(fType, ValueCategory.PRVALUE, compositeValue);