When creating an object that is a copy of a virtual
function return value (a temporary object) using the compiler-supplied copy
constructor, you may get the following error:
test.cpp(22) : fatal error C1001: INTERNAL COMPILER ERROR
'msc1.cpp', line 1794)
Please choose the Technical Support command on the
Help menu, or open the Technical Support help file for more
Please see the steps to reproduce in the More
Information section below.
There are four ways to get around the problem:
- Explicitly Define a Copy Constructor. (See Workaround #1 in
sample code below).
- Remove the virtual keyword from the function which returns
the value. (See Workaround #2 in sample code below).
- Introduce a temporary variable to store the return value.
(See Workaround #3 in the sample code below).
- Remove compiler support for synchronous (C++) exception
handling. This is accomplished by removing /GX (the Visual Studio default) from
your compile options. (See Workaround #4 in sample code below).
Workaround #1 is the recommended workaround whenever possible.
: If you define a copy constructor, you should also define an
assignment operator (operator=).
Microsoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
This problem was corrected in Microsoft Visual C++