cygwin + mingwn + gcc 相談室 Part2
■ このスレッドは過去ログ倉庫に格納されています
0198デフォルトの名無しさん
2005/12/15(木) 13:07:49を使っているのですが
template <typename T> struct NumericTypeInfo {};
template <> struct NumericTypeInfo<int> { typedef long LongerType; typedef short ShorterType; };
template <> struct NumericTypeInfo<short> { typedef int LongerType; typedef char ShorterType; };
template <> struct NumericTypeInfo<long> { typedef long long LongerType; typedef int ShorterType; };
template <typename T>
T TestFunc(T val)
{
#if 0
NumericTypeInfo<int>::LongerType tmp = val; // これは大丈夫
#else
NumericTypeInfo<T>::LongerType tmp = val; // コンパイルエラーになる...
#endif
tmp << 8;
tmp >> 8;
return tmp;
}
これでコンパイルエラーになります。コンパイラのバグでしょうか?
■ このスレッドは過去ログ倉庫に格納されています