FATAL Internal Error - Visual C++ DOTNET 2003

  • Thread starter Thread starter Jacob Bensabat
  • Start date Start date
J

Jacob Bensabat

Hi
I am trying to do the following

template <class X>
class CA
{
public:
X m_a;
X m_b;
X Get(X& a,X& b)
{
m_a = a;
m_b = b;
}
};


template <class X>
class CB
{
class CA<X>;
public:
X m_a;
X m_b;
X Get(X& a,X& b)
{
m_a = a;
m_b = b;
}
};

when I try to compile I get a fatal internal error c2001
on the line that declares class CA<X> inside the class
CB.
the help suggests to disable optimizations. But these
are disabled anyway.
Any help would really be appreciated.
thanks
jac
 
Jacob Bensabat said:
Hi
I am trying to do the following

template <class X>
class CA
{
public:
X m_a;
X m_b;
X Get(X& a,X& b)
{
m_a = a;
m_b = b;
}
};


template <class X>
class CB
{
class CA<X>;

I think the following syntax is used to forward declare:

template <class X_> class CA;

Maybe that causes the internal compiler error.
public:
X m_a;
X m_b;
X Get(X& a,X& b)
{
m_a = a;
m_b = b;
}
};

when I try to compile I get a fatal internal error c2001
on the line that declares class CA<X> inside the class
CB.
the help suggests to disable optimizations. But these
are disabled anyway.
Any help would really be appreciated.
thanks
jac

Tom.
 
Jacob,

FWIW, the Whidbey compiler doesn't suffer from the ICE :)

At this line:
class CA<X>;

it reports:

error C2906: 'CA<X>' : explicit specialization requires 'template <>'
and
error C2908: explicit specialization; 'CA<X>' has already been
instantiated

If you make the code:

template class CA<X>;

it'll compile ok.

Dave
 
Back
Top