INTERNAL Compiler error with VC 7.1 compiler

  • Thread starter Thread starter Ravikiran
  • Start date Start date
R

Ravikiran

Hi,

I am trying to compile a code developed using VC6 in VC 7.1 compiler.

I get a "Internal compiler error" for what I think is a very simple
piece of code.

I tried to reproduce the problem and it is possible with the code below.

//------------------------------------
//ForwardDecl.h
//------------------------------------
class CString;
class Temp
{
public:
Temp(const CString& szStr);
};

//------------------------------------
//ForwardDecl.cpp
//------------------------------------
# include <afx.h>
# include "ForwardDecl.h"
int _tmain(int argc, _TCHAR* argv[])
{
CString szTemp;
Temp t(szTemp);
return 0;
}

It gives a ICE on line 1 of ForwardDecl.h.
Of course I can include <afx.h> in the ForwardDecl.h and get away with it.
But I don't want to unnecessarily include a header.
Is there any other solution?

Best Regards,
ravi.

PS: If you want to reply directly, pl. remove the .net from my mail address.
Sorry for the inconvenience!
 
Ravikiran said:
Hi,

I am trying to compile a code developed using VC6 in VC 7.1 compiler.

I get a "Internal compiler error" for what I think is a very simple
piece of code.

I tried to reproduce the problem and it is possible with the code below.

//------------------------------------
//ForwardDecl.h
//------------------------------------
class CString;

CString is no longer a class, but a typedef for a template. You cannot
forward declare it like this (probably not at all).


Bo Persson
(e-mail address removed)
 
Bo Persson said:
CString is no longer a class, but a typedef for a template. You cannot
forward declare it like this (probably not at all).

Yes, but the compiler shouldn't puke when it sees such a declaration; it
should give a reasonable error message. ICE is always a bug.

Ken
 
I get a "Internal compiler error" for what I think is a very simple
Thanks for reporting this bug Ravi. We have already fixed this problem --
however it was too late for 7.1 compiler, so the fix will only appear in
the next version.

To avoid the ICE, remove forward declaration of CString -- you don't need
it if you include afx.h.
Yes, but the compiler shouldn't puke when it sees such a declaration; it
should give a reasonable error message. ICE is always a bug.

Correct -- ICE is always a bug.

Artur Laksberg,
Visual C++ Compiler Development Team
This posting is provided AS IS with no warranties, and confers no rights.
 
Back
Top