[Bug c++/24056] New: failed lookup of static non-member operator function with certain templated arguments

pogonyshev at gmx dot net gcc-bugzilla@gcc.gnu.org
Sun Sep 25 16:19:00 GMT 2005


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



More information about the Gcc-bugs mailing list