public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23213] New: Error in Koenig Lookup causes overload resolution failure
@ 2005-08-03  6:59 adah at netstd dot com
  2005-08-03 12:56 ` [Bug c++/23213] " pinskia at gcc dot gnu dot org
  2005-08-04 10:02 ` gdr at integrable-solutions dot net
  0 siblings, 2 replies; 3+ messages in thread
From: adah at netstd dot com @ 2005-08-03  6:59 UTC (permalink / raw)
  To: gcc-bugs

http://groups-beta.google.com/group/comp.lang.c++.moderated/browse_thread/thread/3c449572456c8592

The test program:

#include <vector>
int distance(std::vector<int> v1, std::vector<int> v2)
{
    return v1.size() - v2.size();
}
int main()
{
    std::vector<int> v1(3), v2(1);
    int d = distance(v1, v2);
    return 0;
}

The error message from 3.4.4:

D:/mingw-gcc3.4/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_iterator_base_types.h:
In instantiation of `std::iterator_traits<std::vector<int, std::allocator<int> > >':
test1.cpp:11:   instantiated from here
D:/mingw-gcc3.4/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_iterator_base_types.h:129:
error: no type named `iterator_category' in `class std::vector<int,
std::allocator<int> >'

It has been confirmed that the problem is not that Koenig lookup takes priority
over the local overload, etc.  It is that the failure to deduce the return type
of the instantiation of std::distance<>() caused the abortion of candidate
building.  If the necessary typedef is provided, the local version of distance
will be correctly selected.

It might be arguable whether SFINAE should be applied here (the C++ standard is
not quite clear on this).  But I do not think it the purpose of the standard to
let something in the std namespace affect local name resolution.  Maybe you
gurus here can judge better?

This problem occurs from 2.95.3 to 3.4.4.  I believe it is platform-independent.

-- 
           Summary: Error in Koenig Lookup causes overload resolution
                    failure
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: adah at netstd dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-pc-mingw32
  GCC host triplet: i386-pc-mingw32
GCC target triplet: i386-pc-mingw32


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


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

* [Bug c++/23213] Error in Koenig Lookup causes overload resolution failure
  2005-08-03  6:59 [Bug c++/23213] New: Error in Koenig Lookup causes overload resolution failure adah at netstd dot com
@ 2005-08-03 12:56 ` pinskia at gcc dot gnu dot org
  2005-08-04 10:02 ` gdr at integrable-solutions dot net
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-03 12:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-03 12:56 -------


*** This bug has been marked as a duplicate of 15910 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

* [Bug c++/23213] Error in Koenig Lookup causes overload resolution failure
  2005-08-03  6:59 [Bug c++/23213] New: Error in Koenig Lookup causes overload resolution failure adah at netstd dot com
  2005-08-03 12:56 ` [Bug c++/23213] " pinskia at gcc dot gnu dot org
@ 2005-08-04 10:02 ` gdr at integrable-solutions dot net
  1 sibling, 0 replies; 3+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-08-04 10:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2005-08-04 10:02 -------
Subject: Re:  New: Error in Koenig Lookup causes overload resolution failure

"adah at netstd dot com" <gcc-bugzilla@gcc.gnu.org> writes:

| http://groups-beta.google.com/group/comp.lang.c++.moderated/browse_thread/thread/3c449572456c8592

[...]

| not quite clear on this).  But I do not think it the purpose of the standard to
| let something in the std namespace affect local name resolution.  Maybe you
| gurus here can judge better?

Whether you like it or not, you have to take it to the C++ committee.
It is not GCC's job to "fix" C++ standard semantics you would not
like.

-- Gaby


-- 


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


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

end of thread, other threads:[~2005-08-04 10:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-03  6:59 [Bug c++/23213] New: Error in Koenig Lookup causes overload resolution failure adah at netstd dot com
2005-08-03 12:56 ` [Bug c++/23213] " pinskia at gcc dot gnu dot org
2005-08-04 10:02 ` gdr at integrable-solutions 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).