I went to see if you can use auto in a variable template declaration.
template <typename T>
auto F = T{};
Good, but as soon as you try to use it, clang craps.
int f = F<int>;
auto f = F<int>;
decltype(F<int>) f = F<int>;
std::cout << std::is_same<int, decltype(F<int>)>::value;
std::cout << typeid(decltype(F<int>)).name();
std::cout << std::is_same<decltype(F<int>), decltype(F<int>)>::value;
Any combination decltype(auto), autodoes not work, although she says that autois an lvalue.
int f = static_cast<int>(F<int>);
I had never seen automatic action before. Is it due to template variables or is it because clang handles auto?
source
share