From 8e871b492f5a00fa5c6974de19fe775cd93482ad Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Fri, 25 Apr 2014 22:22:05 -0700 Subject: [PATCH] Bug 433556 - Unqualified name of the containing template is not resolved --- .../cdt/core/parser/tests/ast2/AST2CPPTests.java | 2 +- .../dom/parser/cpp/semantics/CPPTemplates.java | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index d4500c533d1..e58fa32fe5e 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -432,7 +432,7 @@ public class AST2CPPTests extends AST2TestBase { // struct A::B { // typedef typename A::type type; // }; - public void _testBug433556() throws Exception { + public void testBug433556() throws Exception { parseAndCheckBindings(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java index 84e1188fcfb..1c358594f66 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java @@ -300,7 +300,7 @@ public class CPPTemplates { // definition cannot be inside a template scope, we can accurately return null // in this case. if (functionName.getParent() instanceof ICPPASTQualifiedName - && ASTQueries.isAncestorOf(functionName.getParent(), name)) { + && ASTQueries.isAncestorOf(functionName.getParent(), name)) { return null; } scope= CPPVisitor.getContainingScope(functionName); @@ -334,9 +334,15 @@ public class CPPTemplates { } if (scope instanceof IASTInternalScope) { IASTInternalScope internalScope= (IASTInternalScope) scope; - scope= CPPVisitor.getContainingScope(internalScope.getPhysicalNode()); - if (scope == internalScope) - return null; + IASTNode physicalNode = internalScope.getPhysicalNode(); + if (physicalNode instanceof ICPPASTCompositeTypeSpecifier && + ((ICPPASTCompositeTypeSpecifier) physicalNode).getName() instanceof ICPPASTQualifiedName) { + scope= scope.getParent(); + } else { + scope= CPPVisitor.getContainingScope(physicalNode); + if (scope == internalScope) + return null; + } } else { scope= scope.getParent(); }