1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Using declarations in combination with nested classes, bug 209582.

This commit is contained in:
Markus Schorn 2008-02-08 15:03:38 +00:00
parent c754042629
commit e08ec31825
2 changed files with 21 additions and 1 deletions

View file

@ -5667,4 +5667,24 @@ public class AST2CPPTests extends AST2BaseTest {
assertEquals(1, tu.getDefinitionsInAST(b).length); // using-decl assertEquals(1, tu.getDefinitionsInAST(b).length); // using-decl
assertEquals(2, tu.getDeclarationsInAST(b).length); // using-decl + func-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());
}
} }

View file

@ -1108,7 +1108,7 @@ public class CPPSemantics {
HashSet<ICPPNamespaceScope> handled= new HashSet<ICPPNamespaceScope>(); HashSet<ICPPNamespaceScope> handled= new HashSet<ICPPNamespaceScope>();
for( int i = 0; i < uds.length; i++ ){ for( int i = 0; i < uds.length; i++ ){
final ICPPUsingDirective ud = uds[i]; final ICPPUsingDirective ud = uds[i];
if( CPPSemantics.declaredBefore( ud, blockItem ) ){ if( CPPSemantics.declaredBefore( ud, data.astName ) ){
storeUsingDirective(data, blockScope, ud, handled); storeUsingDirective(data, blockScope, ud, handled);
} }
} }