468,107 Members | 1,446 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,107 developers. It's quick & easy.

FATAL Internal Error - Visual C++ DOTNET 2003

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
Nov 17 '05 #1
3 2442
"Jacob Bensabat" <jb*******@ewre.com> wrote in message
news:01****************************@phx.gbl...
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.
Nov 17 '05 #2
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
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #3
Hi
thanks
David's solution did the job
jac.

Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by JimmyS | last post: by
1 post views Thread by Irakli Lomidze | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.