While playing around with some of the new C++17 features in Visual C++ - I came across an issue which to me seems like a bug. The code seems to generate as expected when compiling under other compilers using compiler explorer. The error that is generated :
Using Visual Studio 2017 15.3.5
error C2027: use of undefined type 'std::tuple<unknown-type>'
note: see declaration of 'std::tuple<unknown-type>'
note: see reference to function template instantiation 'void DoSomething<>(void)' being compiled
error C2903: 'remove_reference_t': symbol is neither a class template nor a function template
#include <type_traits>
#include <tuple>
struct t_metadata
{
using type = int;
};
template<typename ...Types>
void DoSomething()
{
if constexpr (sizeof...(Types) < 1)
{
DoSomething<Types..., t_metadata>();
}
else
{
using T1 = std::remove_reference_t<decltype(std::get<0>(std::tuple<Types...>{}))>;
typename T1::type tempVal{ };
}
}
int main()
{
DoSomething<>();
return 0;
}