https://bugs.llvm.org/show_bug.cgi?id=48558
Bug ID: 48558
Summary: using-directive injects names into wrong namespace
scope
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: arthur.j.odw...@gmail.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
// https://godbolt.org/z/8bEMfW
struct Cat {};
struct Lion : Cat {};
namespace Outer {
namespace Inner {
namespace N1 {
int foo(Cat);
}
namespace N2 {
int test();
}
}
int foo(Lion);
int Inner::N2::test() {
using namespace Inner::N1;
return (foo)(Lion());
}
}
When Clang sees the using-directive, it seems to insert a declaration of
Outer::Inner::N1::foo(Cat) into the lowest-common-ancestor namespace of Outer
(where the definition of `Inner::N2::test()` appears) and Outer::Inner::N1.
However, it SHOULD insert the declaration into the lowest-common-ancestor
namespace of Outer::Inner::N2 (where the original declaration of `test()`
appeared) and Outer::Inner::N1.
The parens in `(foo)(Lion())` are just there to turn off ADL to simplify the
example; they're not relevant to the bug.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs