This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15910] New: can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: "king dot benjamin at mh-hannover dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Jun 2004 14:39:19 -0000
- Subject: [Bug c++/15910] New: can't compile self defined void distance(std::vector<T>, std::vector<T>)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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);
----
--
Summary: can't compile self defined void distance(std::vector<T>,
std::vector<T>)
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: king dot benjamin at mh-hannover dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: 3.3.2
GCC host triplet: 3.3.2
GCC target triplet: 3.3.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15910
- Follow-Ups:
- [Bug c++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: king dot benjamin at mh-hannover dot de
- [Bug c++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: king dot benjamin at mh-hannover dot de
- [Bug c++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: bangerth at dealii dot org
- [Bug c++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: giovannibajo at libero dot it
- [Bug c++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: pinskia at gcc dot gnu dot org
- [Bug c++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: giovannibajo at libero dot it
- [Bug c++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: giovannibajo at libero dot it
- [Bug c++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: bangerth at dealii dot org
- [Bug libstdc++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: giovannibajo at libero dot it
- [Bug libstdc++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: giovannibajo at libero dot it
- [Bug libstdc++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: bangerth at dealii dot org
- [Bug libstdc++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: giovannibajo at libero dot it
- [Bug libstdc++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: giovannibajo at libero dot it