[Daniel James]
I don't know how to find out about "DevDiv#796414" so I don't know if it's the same issue.
That's our internal database. (I cite bug numbers so if people ask me about them later I can look them up.)
This is the example from the start of the thread which was confirmed to fail on Visual C++.
Thanks, that's the same bug. Just in case, I've reduced your example and added it to the bug:
C:\Temp>type purr.cpp
#include
struct string {
string(const char *);
template <typename InIt> string(InIt, InIt);
};
void insert(const string&) { }
void insert(std::initializer_list<string>) { }
int main() {
insert("a");
insert({ "b" });
insert({ "c", "d" });
}
C:\Temp>cl /EHsc /nologo /W4 purr.cpp
purr.cpp
purr.cpp(13) : error C2668: 'insert' : ambiguous call to overloaded function
purr.cpp(9): could be 'void insert(std::initializer_list<string>)'
purr.cpp(8): or 'void insert(const string &)'
while trying to match the argument list '(initializer-list)'
purr.cpp(14) : error C2668: 'insert' : ambiguous call to overloaded function
purr.cpp(9): could be 'void insert(std::initializer_list<string>)'
purr.cpp(8): or 'void insert(const string &)'
while trying to match the argument list '(initializer-list)'
The bit of Standardese that we're not following is N3690 13.3.3.2 [over.ics.rank]/3: "List-initialization sequence L1 is a better conversion sequence than list-initialization sequence L2 if L1 converts to std::initializer_list<X> for some X and L2 does not."
[Glen Fernandes]
Stephan, I seem to recall providing a slightly similar example that
you added as repro to DevDiv#532674 when you renamed it "[Milan]
initializer_list overloading" on 2012/11/29.
Half of that was the same bug (your complex<double> example).
STL