public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/24056] New: failed lookup of static non-member operator function with certain templated arguments
@ 2005-09-25 16:19 pogonyshev at gmx dot net
  2005-09-25 16:20 ` [Bug c++/24056] " pogonyshev at gmx dot net
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: pogonyshev at gmx dot net @ 2005-09-25 16:19 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/24056] failed lookup of static non-member operator function with certain templated arguments
  2005-09-25 16:19 [Bug c++/24056] New: failed lookup of static non-member operator function with certain templated arguments pogonyshev at gmx dot net
@ 2005-09-25 16:20 ` pogonyshev at gmx dot net
  2005-09-25 16:23 ` pinskia at gcc dot gnu dot org
  2005-09-25 16:54 ` pogonyshev at gmx dot net
  2 siblings, 0 replies; 6+ messages in thread
From: pogonyshev at gmx dot net @ 2005-09-25 16:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pogonyshev at gmx dot net  2005-09-25 16:20 -------
Created an attachment (id=9805)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9805&action=view)
testcase


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24056


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/24056] failed lookup of static non-member operator function with certain templated arguments
  2005-09-25 16:19 [Bug c++/24056] New: failed lookup of static non-member operator function with certain templated arguments pogonyshev at gmx dot net
  2005-09-25 16:20 ` [Bug c++/24056] " pogonyshev at gmx dot net
@ 2005-09-25 16:23 ` pinskia at gcc dot gnu dot org
  2005-09-25 16:54 ` pogonyshev at gmx dot net
  2 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-25 16:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-25 16:23 -------
Comeau online also rejects this.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24056


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/24056] failed lookup of static non-member operator function with certain templated arguments
  2005-09-25 16:19 [Bug c++/24056] New: failed lookup of static non-member operator function with certain templated arguments pogonyshev at gmx dot net
  2005-09-25 16:20 ` [Bug c++/24056] " pogonyshev at gmx dot net
  2005-09-25 16:23 ` pinskia at gcc dot gnu dot org
@ 2005-09-25 16:54 ` pogonyshev at gmx dot net
  2 siblings, 0 replies; 6+ messages in thread
From: pogonyshev at gmx dot net @ 2005-09-25 16:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pogonyshev at gmx dot net  2005-09-25 16:54 -------
So, not a bug then?  I still don't understand why this code is ill-formed, though.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24056


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/24056] failed lookup of static non-member operator function with certain templated arguments
       [not found] <bug-24056-11205@http.gcc.gnu.org/bugzilla/>
  2006-10-12  1:03 ` bangerth at dealii dot org
@ 2006-10-12 18:58 ` pogonyshev at gmx dot net
  1 sibling, 0 replies; 6+ messages in thread
From: pogonyshev at gmx dot net @ 2006-10-12 18:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pogonyshev at gmx dot net  2006-10-12 18:58 -------
OK, thanks for the help.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24056


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/24056] failed lookup of static non-member operator function with certain templated arguments
       [not found] <bug-24056-11205@http.gcc.gnu.org/bugzilla/>
@ 2006-10-12  1:03 ` bangerth at dealii dot org
  2006-10-12 18:58 ` pogonyshev at gmx dot net
  1 sibling, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2006-10-12  1:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from bangerth at dealii dot org  2006-10-12 01:03 -------
The operator== you want to call is used in a context in which the
template argument cannot be deduced (a "non-deduceable context").

If you want to use this construct, you will have to write something like
    templated_nested::operator==<int> (x, y);
instead of plain
    x == y;

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24056


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-10-12 18:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-25 16:19 [Bug c++/24056] New: failed lookup of static non-member operator function with certain templated arguments pogonyshev at gmx dot net
2005-09-25 16:20 ` [Bug c++/24056] " pogonyshev at gmx dot net
2005-09-25 16:23 ` pinskia at gcc dot gnu dot org
2005-09-25 16:54 ` pogonyshev at gmx dot net
     [not found] <bug-24056-11205@http.gcc.gnu.org/bugzilla/>
2006-10-12  1:03 ` bangerth at dealii dot org
2006-10-12 18:58 ` pogonyshev at gmx dot net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).