1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 486144 - Avoid recursion due to EvalID.withinNonStaticMethod() doing over-eager name resolution

Change-Id: I51de1941753c3d6beb0f21eebaff01f2cf87a9fb
This commit is contained in:
Nathan Ridge 2016-01-19 19:24:01 -05:00
parent 423dc228fa
commit 9e7b1ce856
2 changed files with 7 additions and 1 deletions

View file

@ -9133,7 +9133,6 @@ public class AST2TemplateTests extends AST2TestBase {
// C<T>::c; // problems on C, T and ::c
// }
public void testRegression_485388a() throws Exception {
CPPASTNameBase.sAllowRecursionBindings = true; // bug 486144
parseAndCheckBindings(getAboveComment(), CPP, true);
}

View file

@ -308,6 +308,13 @@ public class EvalID extends CPPDependentEvaluation {
}
if (parent instanceof ICPPASTFunctionDefinition) {
ICPPASTFunctionDefinition fdef= (ICPPASTFunctionDefinition) parent;
// Resolution of the method name triggers name resolution inside the
// decl-specifier of the method definition. If we are currently
// resolving something inside the decl-specifier, this can lead to
// recursion.
if (ASTQueries.isAncestorOf(fdef.getDeclSpecifier(), expr)) {
return null;
}
final IBinding methodBinding = fdef.getDeclarator().getName().resolvePreBinding();
if (methodBinding instanceof ICPPMethod && !((ICPPMethod) methodBinding).isStatic()) {
IScope scope = CPPVisitor.getContainingScope(expr);