
19 Oct
2013
19 Oct
'13
8:12 p.m.
On 19 October 2013 19:40, Glen Fernandes
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: 'thingstd::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_liststd::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.