64-bit G++ 4.6.3 doesn't treat longs as long longs in specialised function templates, even though they're the same size. Is this a bug?
问题 Consider the following code: #include <iostream> #include <cinttypes> template<class T> void f(); template<> inline void f<long long>() { std::cout<<"f<long long>()"<<std::endl; } int main(int , char** ) { std::cout<<"sizeof(long)="<<sizeof(long)<<std::endl; std::cout<<"sizeof(long long)="<<sizeof(long long)<<std::endl; f<int64_t>(); return 0; } 32-bit G++ 4.6.3 compiles this successfully and produces the output: sizeof(long)=4 sizeof(long long)=8 f<long long>() Compiling under 64-bit G++ 4.6