public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/44708]  New: Enabling -std=c++0x results in ambiguous function overload in <ext/algorithm> header
@ 2010-06-29  8:10 oakad at yahoo dot com
  2010-06-29  9:16 ` [Bug libstdc++/44708] " paolo dot carlini at oracle dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: oakad at yahoo dot com @ 2010-06-29  8:10 UTC (permalink / raw)
  To: gcc-bugs

The example program below will exhibit the problem when compiled with
-std=c++0x or gnu++0x flag. The fix appears to be trivial, but requires a
change to <ext/algorithm> header.

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

using namespace std;

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

        cout << line.c_str() << endl;
        return 0;
}

Compilation error message:
In file included from
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/ext/ropeimpl.h:48,        
                 from
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/ext/rope:2956,            
                 from testrope.cpp:2:                                           
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/ext/algorithm: In
function &#8216;std::pair<_InputIter, _ForwardIter>
__gnu_cxx::copy_n(_InputIterator, _Size, _OutputIterator) [with _InputIterator
= char*, _Size = long unsigned int, _OutputIterator = char*]&#8217;:            
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/ext/ropeimpl.h:1090:  
instantiated from &#8216;static _CharT* __gnu_cxx::rope<_CharT,
_Alloc>::_S_flatten(__gnu_cxx::_Rope_RopeRep<_CharT, _Alloc>*, _CharT*) [with
_CharT = char, _Alloc = std::allocator<char>]&#8217;
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/ext/ropeimpl.h:1621:  
instantiated from &#8216;const _CharT* __gnu_cxx::rope<_CharT, _Alloc>::c_str()
const [with _CharT = char, _Alloc = std::allocator<char>]&#8217;
testrope.cpp:10:   instantiated from here
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/ext/algorithm:127: error:
call of overloaded &#8216;__copy_n(char*&, long unsigned int&, char*&,
std::random_access_iterator_tag)&#8217; is ambiguous
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/ext/algorithm:78: note:
candidates are: std::pair<_InputIter, _ForwardIter>
__gnu_cxx::__copy_n(_InputIterator, _Size, _OutputIterator,
std::input_iterator_tag) [with _InputIterator = char*, _Size = long unsigned
int, _OutputIterator = char*]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/ext/algorithm:93: note:  
              std::pair<_InputIter, _ForwardIter>
__gnu_cxx::__copy_n(_RAIterator, _Size, _OutputIterator,
std::random_access_iterator_tag) [with _RAIterator = char*, _Size = long
unsigned int, _OutputIterator = char*]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/bits/stl_algo.h:1003:
note:                 _OutputIterator std::__copy_n(_RandomAccessIterator,
_Size, _OutputIterator, std::random_access_iterator_tag) [with
_RandomAccessIterator = char*, _Size = long unsigned int, _OutputIterator =
char*]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.2/include/g++-v4/bits/stl_algo.h:988:
note:                 _OutputIterator std::__copy_n(_InputIterator, _Size,
_OutputIterator, std::input_iterator_tag) [with _InputIterator = char*, _Size =
long unsigned int, _OutputIterator = char*]


-- 
           Summary: Enabling -std=c++0x results in ambiguous function
                    overload in <ext/algorithm> header
           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=44708


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-06-29 10:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-29  8:10 [Bug libstdc++/44708] New: Enabling -std=c++0x results in ambiguous function overload in <ext/algorithm> header oakad at yahoo dot com
2010-06-29  9:16 ` [Bug libstdc++/44708] " paolo dot carlini at oracle dot com
2010-06-29  9:20 ` paolo dot carlini at oracle dot com
2010-06-29 10:04 ` paolo at gcc dot gnu dot org
2010-06-29 10:04 ` paolo dot carlini at oracle dot com
2010-06-29 10:04 ` paolo at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).