FIX: Conversion to System:Object May Result in C2594 Ambiguity Error Message (324042)
The information in this article applies to:
- Microsoft Visual C++ .NET (2002)
This article was previously published under Q324042 SYMPTOMS When you try to convert a pointer to a managed object to System::Object *, you may receive the following error message from the compiler:
error C2594: 'initializing' : ambiguous conversions from
'namespace::Derived __gc *' to 'System::Object __gc
*' CAUSE This behavior occurs when the following two conditions are
true:
- The managed pointer is of a class that derives from a class
named Object.
-and- - Precompiled header options are turned on.
In this situation, the compiler cannot distinguish between the System::Object and the base Object class, so the compiler incorrectly issues the C2594 error.
RESOLUTION To work around the problem, rename the base class to
something other than Object. STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
This bug was corrected in Microsoft Visual C++ .NET (2003).
Modification Type: | Major | Last Reviewed: | 4/11/2003 |
---|
Keywords: | kbfix kbbug kbCompiler kberrmsg kbManaged kbpending KB324042 |
---|
|