c++ template conformance: gcc vs MS

Mark Tall mtall.qld@gmail.com
Thu May 28 06:12:00 GMT 2009


Hello,

I've come across a possible issue with GCC's adherence to the C++
standard for handling template code (gcc version 4.3.2 20081105 from
Fedora 10).

The following code compiles fine under GCC (using -pedantic and
-std=c++98), but fails under Microsoft's C++ 2008 SP1.

Microsoft explains this on
http://msdn.microsoft.com/en-us/library/cx7k7hcf(VS.80).aspx

Is GCC or Microsoft at fault ?


Code (from a header file):

template<typename T1>
struct get_num_type
  { typedef T1 num_type; };

template<>  // this line causes the problem
template<typename T2>
struct get_num_type< std::complex<T2> >
{ typedef T2 num_type; };

MS compilers gives:
error C2910: 'arma::get_pod_type<std::complex<_Other>>' : cannot be
explicitly specialized



More information about the Gcc mailing list