I'm encountering an unexpected issue in some code I'm writing now and I'm not sure which compiler is correct.
We have a multi-argument constructor which takes const char*, const char*
, but it is declared explicit:
constexpr explicit Wrapper(const char* a, const char* b) : pair(a,b){}
And then we have a function which takes Wrapper
and an overload which takes a std::pair<const char*, const char*>
void q(Wrapper w); void q(std::pair<const char *, const char *> w);
And then we have code like this, which I would expect to call the second overload:
q({"a", "b"});
This compiles fine on clang, but fails to compile on both GCC and MSVC. I've been trying to look for any mention of explicit multi-arg constructor in the standard and if there's anything mentioning this ambiguity but I haven't found the relevant text. I'm just wondering which behavior is correct and which is wrong?
godbolt link: http://ift.tt/2eJMRMH
Aucun commentaire:
Enregistrer un commentaire