mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 508254 - Static field of enclosing class type
We previously guarded against recursion in this case, but the result was an invalid composite value that could cause problems down the line. This patch avoids getting into the recursion to begin with by skipping the processing of static fields in a case where it's not necessary to begin with. Change-Id: Ic3a346092bb7ad5c94cd15871110dd17ecd64886
This commit is contained in:
parent
03bcd35cdf
commit
b4ffef7cbb
2 changed files with 15 additions and 0 deletions
|
@ -2396,4 +2396,17 @@ public class IndexCPPBindingResolutionTest extends IndexBindingResolutionTestBas
|
|||
public void testFriendClassDeclaration_508338() throws Exception {
|
||||
getProblemFromFirstIdentifier("B*");
|
||||
}
|
||||
|
||||
// class waldo {
|
||||
// static waldo instance;
|
||||
//
|
||||
// constexpr waldo() {}
|
||||
// };
|
||||
//
|
||||
// waldo waldo::instance;
|
||||
|
||||
// // empty file
|
||||
public void testStaticFieldOfEnclosingType_508254() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,6 +216,8 @@ public final class CompositeValue implements IValue {
|
|||
|
||||
ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, null);
|
||||
for (ICPPField field : fields) {
|
||||
if (field.isStatic())
|
||||
continue;
|
||||
final ICPPEvaluation value = EvalUtil.getVariableValue(field, record);
|
||||
int fieldPos = CPPASTFieldReference.getFieldPosition(field);
|
||||
record.update(field, value);
|
||||
|
|
Loading…
Add table
Reference in a new issue