1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Bug 392577 - Members of anonymous namespace visible outside file

This commit is contained in:
Sergey Prigogin 2012-12-28 17:16:38 -08:00
parent 77c3aa7a9c
commit 0dc04bfd99
2 changed files with 24 additions and 1 deletions

View file

@ -1715,4 +1715,27 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
getBindingFromASTName("f(a)", 1, ICPPFunction.class);
getBindingFromASTName("g(b)", 1, ICPPFunction.class);
}
// namespace ns {
// namespace {
// const char str[] = "";
// }
// }
// namespace {
// const char str[] = "";
// }
//
// namespace ns {
//
// void f(const char* s);
//
// void test() {
// f(str);
// }
//
// }
public void testAnonymousNamespaces_392577() throws Exception {
getBindingFromASTName("f(str)", 1, ICPPFunction.class);
}
}

View file

@ -1057,7 +1057,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
IBinding owner= binding.getOwner();
if (owner instanceof ICPPNamespace) {
if (owner.getNameCharArray().length == 0) {
IASTNode node= ASTInternal.getDeclaredInSourceFileOnly(getPDOM(), owner, false, glob);
IASTNode node= ASTInternal.getDeclaredInSourceFileOnly(getPDOM(), binding, false, glob);
if (node != null) {
file= wpdom.getFileForASTNode(getLinkageID(), node);
}