This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/47709] New: is_heap(standard iterator) becomes ambiguous in C++0x mode


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: unassigned@gcc.gnu.org
        ReportedBy: jyasskin@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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]