https://bugs.llvm.org/show_bug.cgi?id=45216
Bug ID: 45216
Summary: CLANG including struct names when looking up namespace
name candidates
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
The below code compiles on GCC but not on CLANG. Looks like CLANG is looking up
struct identifier names as ns_name candidates in addition to namespace names in
"using ns_name::name;".
https://wandbox.org/permlink/zG6JvMtNwxXK4yPn
////////////////////////////////////////////////////////////////////////////
#include<stdio.h>
namespace N1 {
const char* f() {
return "NamespaceN1::f()";
}
}
namespace N2 {
struct N1 {
static const char* f() {
return "NamespaceN2::StructN1::f()";
}
};
}
using namespace N2;
using N1::f;
int main()
{
printf("%s\n", f());
return 0;
}
////////////////////////////////////////////////////////////////////////////
Compilation Error on CLANG:
prog.cc:18:7: error: reference to 'N1' is ambiguous
using N1::f;
^
prog.cc:3:11: note: candidate found by name lookup is 'N1'
namespace N1 {
^
prog.cc:10:10: note: candidate found by name lookup is 'N2::N1'
struct N1 {
^
prog.cc:22:20: error: use of undeclared identifier 'f'; did you mean 'N1::f'?
printf("%s\n", f());
^
N1::f
prog.cc:4:16: note: 'N1::f' declared here
const char* f() {
^
2 errors generated.
////////////////////////////////////////////////////////////////////////////
Result on GCC:
NamespaceN1::f()
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs