何か間違ったことをしているのか、それともコンパイラのバグなのか疑問に思っています。Windows 用 Intel C++ Composer XE 2011 SP1 (または現在最新のアップデート 6) を使用しています。コード内のコメント行を参照してください。
#include <tchar.h>
#include <iostream>
#include <conio.h>
template <typename ...T>
struct first_va_arg {};
template <typename T0, typename ...T_>
struct first_va_arg<T0, T_...> {
typedef T0 type;
};
template <typename ...T>
inline first_va_arg<T...>::type getFirstArgTypeDefaultValue( const T& ...values )
{
//Next line causes error: nontype "first_va_arg<T...>::type [with T=<T...>]" is not a type name
typedef first_va_arg<T...>::type FirstArgT;
return FirstArgT();
//It works correctly if you comment out the above two lines and uncomment the single line below
//return first_va_arg<T...>::type();
}
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << getFirstArgTypeDefaultValue(5.67, 32) << std::endl;
_getch();
return 0;
}