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++/44963] New: Ambiguous function overload using __gnu_cxx::crope with std::back_inserter in c++0x mode


The example program below will exhibit the problem when compiled with
-std=c++0x or gnu++0x flag. The problem is particularly unfortunate, as rope is
designed for use with back_inserter style constructs.

Example program:
#include <iostream>
#include <ext/rope>

using namespace std;

int main(int argc, char **argv)
{
        __gnu_cxx::crope line("test");
        auto ii(back_inserter(line));

        *ii++ = 'm';
        *ii++ = 'e';

        cout << line << endl;
        return 0;
}

Compilation error message:
testrope1.cpp: In function &#8216;int main(int, char**)&#8217;:
testrope1.cpp:11: error: ambiguous overload for &#8216;operator=&#8217; in
&#8216;ii.std::back_insert_iterator<_Container>::operator++ [with _Container =
__gnu_cxx::rope<char, std::allocator<char>
>](0).std::back_insert_iterator<_Container>::operator* [with _Container =
__gnu_cxx::rope<char, std::allocator<char> >]() = 'm'&#8217;
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/bits/stl_iterator.h:415:
note: candidates are: std::back_insert_iterator<_Container>&
std::back_insert_iterator<_Container>::operator=(typename
_Container::const_reference) [with _Container = __gnu_cxx::rope<char,
std::allocator<char> >]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/bits/stl_iterator.h:423:
note:                 std::back_insert_iterator<_Container>&
std::back_insert_iterator<_Container>::operator=(typename
_Container::value_type&&) [with _Container = __gnu_cxx::rope<char,
std::allocator<char> >]
testrope1.cpp:12: error: ambiguous overload for &#8216;operator=&#8217; in
&#8216;ii.std::back_insert_iterator<_Container>::operator++ [with _Container =
__gnu_cxx::rope<char, std::allocator<char>
>](0).std::back_insert_iterator<_Container>::operator* [with _Container =
__gnu_cxx::rope<char, std::allocator<char> >]() = 'e'&#8217;
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/bits/stl_iterator.h:415:
note: candidates are: std::back_insert_iterator<_Container>&
std::back_insert_iterator<_Container>::operator=(typename
_Container::const_reference) [with _Container = __gnu_cxx::rope<char,
std::allocator<char> >]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/bits/stl_iterator.h:423:
note:                 std::back_insert_iterator<_Container>&
std::back_insert_iterator<_Container>::operator=(typename
_Container::value_type&&) [with _Container = __gnu_cxx::rope<char,
std::allocator<char> >]


-- 
           Summary: Ambiguous function overload using __gnu_cxx::crope with
                    std::back_inserter in c++0x mode
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: oakad at yahoo dot com
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


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


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