diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java index 29189e4ee9b..a3136bc6845 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java @@ -40,7 +40,7 @@ public class CPPASTName extends CPPASTNode implements IASTName { private static final char[] EMPTY_CHAR_ARRAY = {}; private static final String EMPTY_STRING = ""; //$NON-NLS-1$ - private static final int MAX_RESOLUTION_DEPTH = 3; + private static final int MAX_RESOLUTION_DEPTH = 5; private IBinding binding = null; private int fResolutionDepth= 0; @@ -76,6 +76,12 @@ public class CPPASTName extends CPPASTNode implements IASTName { return binding; } + public void incResolutionDepth() { + if (binding == null && ++fResolutionDepth > MAX_RESOLUTION_DEPTH) { + binding= new RecursionResolvingBinding(this); + } + } + public IASTCompletionContext getCompletionContext() { IASTNode node = getParent(); while (node != null) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java index e2d4c74813f..1a9e0470176 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java @@ -940,6 +940,9 @@ public class CPPVisitor { IASTName ns [] = ((ICPPASTQualifiedName)name).getNames(); name = ns[ ns.length - 1 ]; } + if (name instanceof CPPASTName) { + ((CPPASTName) name).incResolutionDepth(); + } IBinding binding = name.getBinding(); if( binding == null ){ binding = CPPSemantics.resolveBinding( name );