ambiguous std::fill with character array

me22 me22.ca@gmail.com
Thu Mar 27 22:04:00 GMT 2008


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.



More information about the Gcc-help mailing list