public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/16862] New: can't compile self defined void distance(std::vector<T>, std::vector<T>)
@ 2004-08-03 18:10 pinskia at gcc dot gnu dot org
2004-08-03 18:10 ` [Bug libstdc++/16862] " pinskia at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-03 18:10 UTC (permalink / raw)
To: gcc-bugs
The following program does not compile:
-----
#include <vector>
double distance(const std::vector<double> & v1, const std::vector<double> & v2)
{
return 0;
}
int main(int argc, char* argv[])
{
std::vector<double> v;
double d;
d = distance(v, v);
return 0;
}
----
In response to a post to gcc-bugs@gcc.gnu.org, Jim Wilson wrote:
----
I am not a C++ expert, so I am really not the right person to be looking at
this. However, I suspect the problem is that the vector
class is itself defined in namespace std, and uses the iterator classes, and
that is somehow causing the search for the distance
function to also look at the interator classes. It isn't just the name
distance, any name in stl_interator.h seems to cause the
same problem.
I can get your testcase to compile if I change
d = distance(v, v);
to
d = ::distance(v, v);
----
------- Additional Comment #3 From Wolfgang Bangerth 2004-06-10 14:45 [reply] -------
Jim is right -- the compiler looks into the namespace of the
arguments when looking for a function 'distance' and therefore
doesn't find the one in global namespace. It does find one
in namespace std::, though, so tries to call it. In the
process of this, it has to do some argument conversions, which
fail -- this is what you get the error messages for.
Jim already mentioned the correct way to write the program so
that it compiles. Note that Intel's compiler also rejects this
program.
W.
------- Additional Comment #13 From Paolo Carlini 2004-08-03 10:33 [reply] -------
I'm looking a bit into this. Frankly, I don't think we really want to complicate
std::distance with the enable_if bits. FWIW, Icc8 (+ Dinkum) behaves *exactly* in
the same way of gcc. On the other hand, the type traits support is in flux and
perhaps we'll be able to easily refine the library in these areas in the near
future. I'm suspending the PR.
--
Summary: can't compile self defined void distance(std::vector<T>,
std::vector<T>)
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org,king dot benjamin at mh-
hannover dot de,pcarlini at suse dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16862
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/16862] can't compile self defined void distance(std::vector<T>, std::vector<T>)
2004-08-03 18:10 [Bug libstdc++/16862] New: can't compile self defined void distance(std::vector<T>, std::vector<T>) pinskia at gcc dot gnu dot org
2004-08-03 18:10 ` [Bug libstdc++/16862] " pinskia at gcc dot gnu dot org
@ 2004-08-03 18:10 ` pinskia at gcc dot gnu dot org
2004-08-03 18:12 ` pinskia at gcc dot gnu dot org
2004-08-03 18:25 ` bangerth at dealii dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-03 18:10 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-08-03 18:10:37
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16862
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/16862] can't compile self defined void distance(std::vector<T>, std::vector<T>)
2004-08-03 18:10 [Bug libstdc++/16862] New: can't compile self defined void distance(std::vector<T>, std::vector<T>) pinskia at gcc dot gnu dot org
@ 2004-08-03 18:10 ` pinskia at gcc dot gnu dot org
2004-08-03 18:10 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-03 18:10 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |SUSPENDED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16862
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/16862] can't compile self defined void distance(std::vector<T>, std::vector<T>)
2004-08-03 18:10 [Bug libstdc++/16862] New: can't compile self defined void distance(std::vector<T>, std::vector<T>) pinskia at gcc dot gnu dot org
2004-08-03 18:10 ` [Bug libstdc++/16862] " pinskia at gcc dot gnu dot org
2004-08-03 18:10 ` pinskia at gcc dot gnu dot org
@ 2004-08-03 18:12 ` pinskia at gcc dot gnu dot org
2004-08-03 18:25 ` bangerth at dealii dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-03 18:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-03 18:12 -------
*** Bug 15910 has been marked as a duplicate of this bug. ***
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16862
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/16862] can't compile self defined void distance(std::vector<T>, std::vector<T>)
2004-08-03 18:10 [Bug libstdc++/16862] New: can't compile self defined void distance(std::vector<T>, std::vector<T>) pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-08-03 18:12 ` pinskia at gcc dot gnu dot org
@ 2004-08-03 18:25 ` bangerth at dealii dot org
3 siblings, 0 replies; 5+ messages in thread
From: bangerth at dealii dot org @ 2004-08-03 18:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-08-03 18:25 -------
Andrew,
All the analysis of what exactly happens, why, what can be done
and why some people believe that we should or shouldn't can be
found in the other PR. None of this information is present
in this PR, so everyone working on the present one would have
to look it up there. I don't see any reason in opening another PR
for this, and therefore will close this and reopen the other one.
W.
*** This bug has been marked as a duplicate of 15910 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|SUSPENDED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16862
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-08-03 18:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-03 18:10 [Bug libstdc++/16862] New: can't compile self defined void distance(std::vector<T>, std::vector<T>) pinskia at gcc dot gnu dot org
2004-08-03 18:10 ` [Bug libstdc++/16862] " pinskia at gcc dot gnu dot org
2004-08-03 18:10 ` pinskia at gcc dot gnu dot org
2004-08-03 18:12 ` pinskia at gcc dot gnu dot org
2004-08-03 18:25 ` bangerth at dealii dot org
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).