Internal compiler error

M

Madhu Gopinathan

Hi,
I am getting the following Internal compiler error

: fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 2701)

as detailed below in VC 7.0 while using compiling template classes

The code is as following

////////////////////////////////////////
//IncludeFile1.h
enum Values
{
kValue1 = 1,
kValue2
};

template<class T, Values value>
class TempClass
{
/// Operator overloads and constructors
};

template<class T, Values value>
class SmartTempClass : SmartPointer<TempClass<T, value> >
{
///Operator overloads
}

#include "IncludeFile1.inl"

//////////////////////////////////////
//IncludeFile1.inl
Non-inline definitions for TempClass and SmartTempClass

/////////////////////////////////
// IncludeFile2.h

#include "IncludeFile1.h"

class Consumer
{
public:
Consumer (const SmartTempClass<int, kValue1> & rkClassValue)
<<----- The error occurs here........
{ //something here }
};


What could be the error here? If I move the template code (for TempClass
and SmartTempClass) inline, the error does not occur.

Thanks,
Madhu
 
C

Carl Daniel [VC++ MVP]

Madhu Gopinathan said:
What could be the error here? If I move the template code (for
TempClass
and SmartTempClass) inline, the error does not occur.

Without seeing a complete sample that produces the ICE, it's impossible to
say. It sounds like you've already found the workaround - put the function
bodies inline in the class definition.

There's a good chance that VC7.1 or VC8.0 (just released) would compile the
code correctly, or give you a better error message if the code is actually
ill-formed.

-cd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top