From 2e1f2d475a536a4aa339a5990826961d8182b90f Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Sun, 5 Feb 2017 02:13:47 -0500 Subject: [PATCH] Bug 511653 - Completion of inheriting constructor in using-declaration Change-Id: If20d85bd6199e8f08152f3a5801bfb30b61d1d09 --- .../core/dom/parser/cpp/CPPASTQualifiedName.java | 3 ++- .../ui/tests/text/contentassist2/CompletionTests.java | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java index 7d26fc5f33a..8679f34d328 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java @@ -314,8 +314,9 @@ public class CPPASTQualifiedName extends CPPASTNameBase ICPPClassType classQualifier = getClassQualifier(); if (classQualifier != null) { final boolean isDeclaration = getParent().getParent() instanceof IASTSimpleDeclaration; + final boolean isUsingDecl = getParent() instanceof ICPPASTUsingDeclaration; List filtered = filterClassScopeBindings(classQualifier, bindings, isDeclaration); - if (isDeclaration && nameMatches(classQualifier.getNameCharArray(), + if ((isDeclaration || isUsingDecl) && nameMatches(classQualifier.getNameCharArray(), n.getLookupKey(), isPrefix)) { ICPPConstructor[] constructors = ClassTypeHelper.getConstructors(classQualifier, n); for (int i = 0; i < constructors.length; i++) { diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java index d08b56dbee6..5332a111334 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java @@ -1868,4 +1868,14 @@ public class CompletionTests extends CompletionTestBase { public void testExistingParens_72391() throws Exception { assertCompletionResults(new String[] { "waldo" }); // expect no parens in replacement } + + // struct A{ + // A(int,int); + // }; + // struct B: A{ + // using A::/*cursor*/ + // }; + public void testInheritingConstructor_511653() throws Exception { + assertCompletionResults(new String[] { "A;" }); + } }