Does anybody know a workaround so that the following code compiles with VC++ 2003?

template< typename t, t v, template< t > class c >
struct s
{
static t r( )
{
return c< v >::r;
}
};

template< typename t >
struct c
{
template< t v >
struct s2
{
static t const r = v;
};
};

int main
(
)
{
s< int, 1, c< int >::s2 >::r( );
}

Btw, a standard-compliant compiler shoud compile this code, shoudn't it?

Re: Workaround for an INTERNAL COMPILER ERROR wanted... by David

David
Sun Jul 24 17:59:36 CDT 2005

>Does anybody know a workaround so that the following code compiles with VC++ 2003?

FWIW, it's OK with the Comeau online compiler and with VS2005 (beta 2)
- if that's an option for you.

Since MS have fixed the problem with VS2005, they may have a limited
patch available for VS2003. You'd need to ring MS PSS and report the
issue to find out though. Alternatively, they could provide you with a
work-around.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq

Re: Workaround for an INTERNAL COMPILER ERROR wanted... by Andre

Andre
Sun Jul 24 23:55:10 CDT 2005

BigMan wrote:
> Does anybody know a workaround so that the following code compiles with
> VC++ 2003?
>
> template< typename t, t v, template< t > class c >
> struct s
> {
> static t r( )
> {
> return c< v >::r;
> }
> };
>
> [...]

The following workaround should help, compiling the code with VS 2003

template< typename t, t v, template< t > class c >
struct s
{
static t r( )
{
typedef c<v> type;
return type::r;
}
};

Andre