Boost logo

Boost :

Subject: Re: [boost] [unordered] Visual C++ 2013 initializer_list overload failure.
From: Daniel James (daniel_at_[hidden])
Date: 2013-10-19 16:12:15


On 19 October 2013 19:40, Glen Fernandes <glen.fernandes_at_[hidden]> wrote:
> Daniel James wrote:
>> x.insert("a");
>> x.insert({"a"});
>> x.insert({"a", "b"});
>
> Indeed; VC12 chokes on the second and third calls to insert(): "error
> C2668: 'thing<std::string>::insert' : ambiguous call to overloaded
> function".

Thanks. It seems that the other overloads of insert are considered
because a string can be implicitly constructed from the initialiser
list ('std::string{"a"}' and 'std::string{"a", "b"}' - I'm afraid I
don't know the correct terminology). Clang and G++ prioritize creating
std::initializer_list<std::string>, while Visual C++ thinks it's
ambiguous.

Does anyone know which compiler is doing the right thing? I assume
it's a Visual C++ bug, but I'm not sure.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk