c++/1675: C++: ambigous overload compile failure

Dirk Mueller dmuell@gmx.net
Tue Jan 16 18:16:00 GMT 2001


>Number:         1675
>Category:       c++
>Synopsis:       C++: ambigous overload compile failure
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 16 18:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Dirk A. Mueller
>Release:        2.97 20010116 (experimental)
>Organization:
none
>Environment:
System: Linux rotes20 2.2.18 #1 Wed Jan 3 16:09:20 CET 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --enable-threads --enable-languages=c,c++
>Description:
Even simple libstdc++/STL based programs fail to compile. 

example:

=== Cut ===
#include <vector.h>

void foo()
{
  vector <char *> vszbar;
  vector <char *>::iterator iter;
  for (iter = vszbar.begin(); iter != vszbar.end(); iter++);
}
int main() { foo(); }
=== Cut ===
 
Command line used to compile this file: 
# g++ -c bar.cc
bar.cc: In function `void foo()':
bar.cc:7: ambiguous overload for `std::__normal_iterator<char**, 
   std::vector<char*, std::allocator<char*> > >& != 
   std::__normal_iterator<char**, std::vector<char*, std::allocator<char*> >
   >' 
   operator
   /usr/local/include/g++-v3/bits/stl_relops.h:37: candidates are: bool 
   std::rel_ops::operator!=(const _Tp&, const _Tp&) [with _Tp = 
   std::__normal_iterator<char**, std::vector<char*,
   std::allocator<char*> > >]
/usr/local/include/g++-v3/bits/stl_iterator.h:1046:
   bool 
   std::operator!=(const std::__normal_iterator<_IteratorL,
   _Container>&, const 
   std::__normal_iterator<_IteratorR, _Container>&) [with
   _IteratorL = char**, 
   _IteratorR = char**, _Container = std::vector<char*,
   std::allocator<char*> >]
			   
 
>How-To-Repeat:

repeat the above steps. 

> Fix:

None known besides avoiding STL. 
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-bugs mailing list