http://llvm.org/bugs/show_bug.cgi?id=8792
Summary: using namespace creates ambiguity when there isn't.
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Following test-case compiles on gcc, but doesn't on clang (r121362)
namespace foo {
struct B {
int i;
};
}
namespace bar {
struct B {
int i;
};
}
using namespace foo;
using namespace bar;
class A {
protected:
struct B {
float f;
};
struct C {
B b;
void foo() { b.f = 0; }
};
};
clang says:
t.cpp:28:9: error: reference to 'B' is ambiguous
B b;
^
t.cpp:4:12: note: candidate found by name lookup is 'foo::B'
struct B {
^
t.cpp:10:12: note: candidate found by name lookup is 'bar::B'
struct B {
^
t.cpp:29:24: error: no member named 'f' in 'foo::B'
void foo() { b.f = 0; }
~ ^
2 errors generated.
So, it forgets about the inner B when same-named struct are brought in with
'using namespace'
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs