By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,357 Members | 982 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,357 IT Pros & Developers. It's quick & easy.

FATAL Internal Error - Visual C++ DOTNET 2003

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
"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

P: n/a
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

P: n/a
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.