I'm not sure if it is a bug, but I couldn't find a justification for this behaviour at http://www.open-std.org/jtc1/sc22/open/n2356/.
To reproduce (`test.cpp' is attached): $ g++ test.cpp -o test gives (here) test.cpp: In function âint main()â: test.cpp:61: error: no match for âoperator==â in âx == yâ Note that there are three similar constructs in `test.cpp' and operator lookup fails only in one of three cases: * templated class A with nested class B: lookup for operator== (A <type>::B, A <type>::B) FAILS * templated class A: lookup for operator== (A <type>, A <type>) SUCCEEDES * non-templated class A with nested class B: lookup for operator== (A::B, A::B) SUCCEEDES I believe all three should succeed or, stated in other words, I don't understand why the first one fails. Granted, I'm not exactly a guru of C++. Namespaces don't affect the behaviour. Member `operator==' is looked up perfectly. This also happens with GCC 3.2. -- Summary: failed lookup of static non-member operator function with certain templated arguments Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pogonyshev at gmx dot net CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24056