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

           Summary: is_heap(standard iterator) becomes ambiguous in C++0x
                    mode
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: jyass...@gcc.gnu.org


$ cat test.cc
#include <ext/algorithm>
#include <vector>

void foo() {
  std::vector<int> v;
  is_heap(v.begin(), v.end());
}
$ g++-4.6svn -c test.cc
$ g++-4.6svn -c test.cc -std=c++0x
test.cc: In function ‘void foo()’:
test.cc:6:29: error: call of overloaded ‘is_heap(std::vector<int>::iterator,
std::vector<int>::iterator)’ is ambiguous
test.cc:6:29: note: candidates are:
include/c++/4.6.0/ext/algorithm:436:5: note: bool
__gnu_cxx::is_heap(_RandomAccessIterator, _RandomAccessIterator) [with
_RandomAccessIterator = __gnu_cxx::__normal_iterator<int*, std::vector<int> >]
include/c++/4.6.0/bits/stl_heap.h:560:72: note: bool std::is_heap(_RAIter,
_RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<int*, std::vector<int> >]


I believe the fix is to "using std::is_heap" into __gnu_cxx in C++0x mode
rather than redefining it there. Another possible fix would be to move
__normal_iterator out of __gnu_cxx to avoid ADL finding that is_heap, but that
wouldn't help people who have already "using __gnu_cxx::is_heap" into their
global namespaces.

Reply via email to