FIX: C1001 When Calling Base Class Conversion Operator (141457)



The information in this article applies to:

  • Microsoft Visual C++, 32-bit Professional Edition 4.0
  • Microsoft Visual C++, 32-bit Learning Edition 4.0

This article was previously published under Q141457

SYMPTOMS

Compiling a C++ file that contains an explicit call to a base class conversion operator, with the /FR compiler option (create Browser information) may result in the following fatal compiler error:
C:\Test\Test.Cpp(22) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 899)

RESOLUTION

There are two possible workarounds:

  • Turn off "Generate browse info" or remove /FR compiler option. -or-

  • Provide an implicit call to the base class conversion operator as demonstrated by the following sample code.

Sample Code

/* Compile options needed: /FR
*/ 

class   Base
{
public:
    operator int()
    {
        return 0;
    }
};

class   Derived : public Base
{
    int fun()
    {
        return  Base::operator int();

// The following line is a workaround for the
// previous line that fails.

   //  return  int(*((Base*)this));
    }
};
				

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ 4.1.

Modification Type:MinorLast Reviewed:7/5/2005
Keywords:kbbug kbcode kbCompiler kbCPPonly kbfix kbVC410fix KB141457