mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +02:00
Bug 392577 - Members of anonymous namespace visible outside file
This commit is contained in:
parent
77c3aa7a9c
commit
0dc04bfd99
2 changed files with 24 additions and 1 deletions
|
@ -1715,4 +1715,27 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
||||||
getBindingFromASTName("f(a)", 1, ICPPFunction.class);
|
getBindingFromASTName("f(a)", 1, ICPPFunction.class);
|
||||||
getBindingFromASTName("g(b)", 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1057,7 +1057,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
IBinding owner= binding.getOwner();
|
IBinding owner= binding.getOwner();
|
||||||
if (owner instanceof ICPPNamespace) {
|
if (owner instanceof ICPPNamespace) {
|
||||||
if (owner.getNameCharArray().length == 0) {
|
if (owner.getNameCharArray().length == 0) {
|
||||||
IASTNode node= ASTInternal.getDeclaredInSourceFileOnly(getPDOM(), owner, false, glob);
|
IASTNode node= ASTInternal.getDeclaredInSourceFileOnly(getPDOM(), binding, false, glob);
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
file= wpdom.getFileForASTNode(getLinkageID(), node);
|
file= wpdom.getFileForASTNode(getLinkageID(), node);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue