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 8e1c665a9d5..87aac410a39 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 @@ -5667,4 +5667,24 @@ public class AST2CPPTests extends AST2BaseTest { assertEquals(1, tu.getDefinitionsInAST(b).length); // using-decl assertEquals(2, tu.getDeclarationsInAST(b).length); // using-decl + func-decl } + + + // namespace x { + // int a; + // } + // using namespace x; + // class O { + // class I { + // void f(); + // }; + // }; + // void O::I::f() { + // a=0; + // } + public void testUsingDirectiveWithNestedClass_Bug209582() throws Exception { + BindingAssertionHelper bh= new BindingAssertionHelper(getContents(1)[0].toString(), true); + + IBinding b= bh.assertNonProblem("a=", 1); + assertEquals("x", b.getScope().getScopeName().toString()); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java index 879b8aba254..b04d948212a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java @@ -1108,7 +1108,7 @@ public class CPPSemantics { HashSet handled= new HashSet(); for( int i = 0; i < uds.length; i++ ){ final ICPPUsingDirective ud = uds[i]; - if( CPPSemantics.declaredBefore( ud, blockItem ) ){ + if( CPPSemantics.declaredBefore( ud, data.astName ) ){ storeUsingDirective(data, blockScope, ud, handled); } }