g++-4.3 rejects the following code:
namespace n1 {
struct foo{};
}
namespace n2 {
struct foo{};
}
using namespace n1;
using namespace n2;
template <typename tp>
int run(tp const & t) {
return t.foo;
}
struct bar {
int foo;
};
int main() {
bar b;
run(b);
}
the error message is:
bug.cpp: In function âint run(const tp&)â:
bug.cpp:14: error: reference to âfooâ is ambiguous
bug.cpp:6: error: candidates are: struct n2::foo
bug.cpp:2: error: struct n1::foo
g++-4.1 and g++-4.2 accept the code, though ...
--
Summary: g++ rejects valid code
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tim at klingt dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35138