diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexMultiFileTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexMultiFileTest.java index 10ce5ef99b2..edd950758da 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexMultiFileTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexMultiFileTest.java @@ -10,14 +10,6 @@ *******************************************************************************/ package org.eclipse.cdt.internal.index.tests; -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.dom.IPDOMManager; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.core.testplugin.CProjectHelper; -import org.eclipse.cdt.core.testplugin.util.TestSourceReader; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; - import junit.framework.TestSuite; /** @@ -351,4 +343,23 @@ public class IndexMultiFileTest extends IndexBindingResolutionTestBase { public void testStackOverflow_514459() throws Exception { checkBindings(); } + + + //test.hpp * + // template class A {}; + // + // struct C { + // C(); + // }; + // + // namespace Ptr2 { + // using C = A; + // } + + //test.cpp + // #include "test.hpp" + // C::C() {} + public void testAliasTemplateReferencingSameName_518937() throws Exception { + checkBindings(); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPScope.java index badcb044d2b..101e80511a7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPScope.java @@ -213,7 +213,12 @@ abstract public class CPPScope implements ICPPASTInternalScope { if (binding instanceof ICPPNamespace) { ICPPNamespaceScope indexNs = ((ICPPNamespace) binding).getNamespaceScope(); IBinding[] bindings = indexNs.getBindings(lookup); - result = ArrayUtil.addAll(IBinding.class, result, bindings); + for (IBinding candidate : bindings) { + if (lookup.isPrefixLookup() || + CPPSemantics.declaredBefore(candidate, lookup.getLookupPoint(), true)) { + result = ArrayUtil.append(result, candidate); + } + } } } catch (CoreException e) { CCorePlugin.log(e);