template<typename T>
void f(T)
{}
int main()
{
auto coll = { 1, 2, 3 };
f(coll); // ok
f({ 1, 2, 3 }); // error
}
My compiler is clang 5.0.
The error message is as follows:
f({ 1, 2, 3 }); // error : no matching function for call to 'f'
note: candidate template ignored: couldn't infer template argument 'T'
Why is that f(coll) is ok but f({ 1, 2, 3 }) is not?