This is the mail archive of the gcc-help@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]

Re: ambiguous std::fill with character array


On Thu, Mar 27, 2008 at 5:11 PM, Maik Beckmann
<beckmann.maik@googlemail.com> wrote:
> Hello
>
>  Consider this snippet
>
>  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?
>

Bug.  Your solution is likely faster than the original, but both should work.

Judging by the error message, you found a very neat case where the
enable_if is both true and false, thanks to the implicit conversion
from char const[4] to char const*, so SFINAE can't prevent either
instantiation, leading to the ambiguity.


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