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

Bug 547534 - Resolve TDEF in getFieldPosition()

and propagate a ProblemType in EvalCompositeAccess.

Change-Id: I20c580c681ea5916d2e1c249b96f41c9dc95082f
Signed-off-by: Hannes Vogt <hannes@havogt.de>
This commit is contained in:
Hannes Vogt 2019-05-23 08:49:16 +02:00
parent 9e4c36a7ab
commit dc62eb218d
2 changed files with 5 additions and 1 deletions

View file

@ -19,6 +19,7 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ALLCVQ;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
import java.util.ArrayList;
import java.util.Arrays;
@ -353,7 +354,7 @@ public class CPPASTFieldReference extends ASTNode
}
public static int getFieldPosition(IBinding binding, IType ownerType) {
final IType nestedType = SemanticUtil.getNestedType(ownerType, ALLCVQ);
final IType nestedType = SemanticUtil.getNestedType(ownerType, ALLCVQ | TDEF);
if (nestedType instanceof ICPPClassType && binding instanceof ICPPField) {
final ICPPField field = (ICPPField) binding;
return getFieldPosition(field);

View file

@ -19,6 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IField;
import org.eclipse.cdt.core.dom.ast.IProblemType;
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
@ -119,6 +120,8 @@ public final class EvalCompositeAccess implements ICPPEvaluation {
return parameterPackType.getTypes()[elementId];
} else if (type instanceof ICPPBasicType) {
return type;
} else if (type instanceof IProblemType) {
return type;
}
return null;
}