From c9e1a95b397bae66e10044e5d9872d9ff062564c Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Tue, 12 Apr 2011 13:02:26 +0000 Subject: [PATCH] Bug 342443: A using declaration is not a definition. --- .../cdt/core/parser/tests/ast2/AST2CPPTests.java | 12 ++++++++++++ .../core/dom/parser/cpp/CPPASTUsingDeclaration.java | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) 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 415d87d9750..c7493b8968a 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 @@ -9379,4 +9379,16 @@ public class AST2CPPTests extends AST2BaseTest { public void testOverloadedOperatorWithInheritanceDistance_335387() throws Exception { parseAndCheckBindings(); } + + // namespace ns {int a;} + // using ns::a; + public void testPropertyOfUsingDeclaration() throws Exception { + IASTTranslationUnit tu= parseAndCheckBindings(); + ICPPASTUsingDeclaration udecl= getDeclaration(tu, 1); + ICPPASTQualifiedName qn= (ICPPASTQualifiedName) udecl.getName(); + assertFalse(qn.isDefinition()); + assertFalse(qn.getLastName().isDefinition()); + assertTrue(qn.isDeclaration()); + assertTrue(qn.getLastName().isDeclaration()); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDeclaration.java index 8a81878f2b4..42da29c2247 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDeclaration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDeclaration.java @@ -99,7 +99,7 @@ public class CPPASTUsingDeclaration extends ASTNode public int getRoleForName(IASTName n) { if (n == name) - return r_definition; + return r_declaration; return r_unclear; }