public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Maik Beckmann <beckmann.maik@googlemail.com>
To: gcc-help@gcc.gnu.org
Subject: ambiguous std::fill with character array
Date: Thu, 27 Mar 2008 21:11:00 -0000	[thread overview]
Message-ID: <200803272211.01096.beckmann.maik@googlemail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

Hello

Consider this snipped
<code>
#include <string>
#include <vector>
#include <algorithm>

int main() {
  std::vector<std::string> foo(20);  
  std::fill(foo.begin(), foo.end(), "bar");
}
</code>

g++-4.2.3 compiles it, but 4.3.0 gives the attached error message.  

The solution is to use
  std::fill(array.begin(), array.end(), std::string("interpolateboundary"));

My question: Is it a bug or by intention?

Thanks,
 -- Maik

[-- Attachment #2: log --]
[-- Type: text/x-diff, Size: 1740 bytes --]

/usr/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_algobase.h: In function 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, _Tp = char [4]]':
/home/maik/workspace/tester/gcc43/fill.cpp:7:   instantiated from here
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_algobase.h:726: error: call of overloaded '__fill_a(std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, const char [4])' is ambiguous
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_algobase.h:683: note: candidates are: typename __gnu_cxx::__enable_if<(! std::__is_scalar::__value), void>::__type std::__fill_a(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, _Tp = char [4]]
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_algobase.h:692: note:                 typename __gnu_cxx::__enable_if<std::__is_scalar::__value, void>::__type std::__fill_a(_ForwardIterator, _ForwardIterator, _Tp) [with _ForwardIterator = std::basic_string<char, std::char_traits<char>, std::allocator<char> >*, _Tp = const char*]
make[2]: *** [CMakeFiles/fill.dir/fill.cpp.o] Error 1
make[1]: *** [CMakeFiles/fill.dir/all] Error 2
make: *** [all] Error 2

             reply	other threads:[~2008-03-27 21:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-27 21:11 Maik Beckmann [this message]
2008-03-27 22:04 ` me22
2008-03-27 22:10   ` Maik Beckmann
2008-03-27 22:21     ` me22
2008-03-27 22:38       ` Maik Beckmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200803272211.01096.beckmann.maik@googlemail.com \
    --to=beckmann.maik@googlemail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).