diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java index a0ff9786c04..c27413fd19c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java @@ -428,9 +428,19 @@ public abstract class PDOMWriter implements IPDOMASTProcessor { // to the index. for (ICPPInternalDeclaredVariable variable : variables) { if (isVariableIndexed(variable)) { - // Type and initial value will be cached by the variable. - variable.getType(); - variable.getInitialValue(); + IASTNode lookupPoint = variable.getDefinition() != null + ? variable.getDefinition() + : (variable.getDeclarations() != null && variable.getDeclarations().length > 0) + ? variable.getDeclarations()[0] + : data.fAST; + CPPSemantics.pushLookupPoint(lookupPoint); + try { + // Type and initial value will be cached by the variable. + variable.getType(); + variable.getInitialValue(); + } finally { + CPPSemantics.popLookupPoint(); + } } }