This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/47709] New: is_heap(standard iterator) becomes ambiguous in C++0x mode
- From: "jyasskin at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 12 Feb 2011 06:35:17 +0000
- Subject: [Bug libstdc++/47709] New: is_heap(standard iterator) becomes ambiguous in C++0x mode
- Auto-submitted: auto-generated
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.