www.digitalmars.com         C & C++   DMDScript  

c++ - typedef template: constant initializer expected error

In the code below, I am getting an error when trying to typedef a template.
The error is a "constant initializer expected". I see this is discussed on
the compiler error list web page, but that discussion is not regarding
templates. I'm a greenhorn when it comes to templates, so I was hoping
someone could explain why it doesn't, or if it should compile according to
the standard. For better or worse, it does compile with several other
compilers.

Thanks.


namespace SPACE {

template < typename ST, bool fp=false, bool gs=false >
struct PixelTraits {

};


template < typename PT >
class PixelAllocater {

};


template < typename BST,
           bool fp=false,
           typename PTT=PixelTraits< BST,fp >,
           typename PAT=PixelAllocater< PTT >
         >
struct BGRAPixel {

};




// Error: constant initializer expected --- errorlevel 1
typedef BGRAPixel<  unsigned char  > SysPixelType0;

// Error: constant initializer expected --- errorlevel 1
typedef BGRAPixel<  unsigned char, false  > SysPixelType1;


// Compiles with DMC
typedef BGRAPixel< unsigned char,
                   false,
                   PixelTraits< unsigned char, false >
                 > SysPixelType2;

// Compiles with DMC
typedef BGRAPixel< unsigned char,
                   false,
                   PixelTraits< unsigned char, false >,
                   PixelAllocater< PixelTraits< unsigned char, false >  >
                 > SysPixelType3;

};





int main()
{
 return 0;
}
Apr 20 2005