failed lookup of static non-member operator function with certain templated arguments

Paul Pogonyshev pogonyshev@gmx.net
Sat Sep 24 20:35:00 GMT 2005


Hi,

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/.

gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
AMD Athlon(tm) XP 2600+, GNU/Linux (Red Hat Linux 8)

To reproduce (`test.cpp' is attached):

$ g++ test.cpp -o test

gives (here)

test.cpp: In function `int main()':
test.cpp:61: no match for `templated_nested::A<int>::B& ==
   templated_nested::A<int>::B&' operator

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.

Paul




-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cpp
Type: text/x-c++src
Size: 1004 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20050924/b648bd38/attachment.bin>


More information about the Gcc-bugs mailing list