When I compile the below code with clang and gcc T
is deduced differently.
#include<initializer_list> //for clang
//to see how T is deduced(form compiler error).
template<typename T>
void foo(T);
int main() {
auto var1{2};
foo(var1);
}
Here is what I got.
clang 3.6(c++11/c++14)
gcc 4.9(c++11/c++14)
T = std::initializer_list<int>
gcc 5.1(c++11/c++14)
T = int
I think T
should be std::initializer_list<int>
.
Why is T = int
in gcc 5.1?