BUG: No Compiler Error for Ambiguous C++ Conversion (116487)
The information in this article applies to:
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Editions 4.2
- Microsoft Visual C++, 32-bit Editions 5.0
- Microsoft Visual C++, 32-bit Editions 6.0
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C++ .NET (2003)
This article was previously published under Q116487 SYMPTOMS Class A has a member function that converts an instance of
class B to an instance of class A. Class B also has a member function that
converts an instance of class B to an instance of class A. Therefore, when you
assign an instance of class B to an instance of class A, the compiler could use
both conversion methods, resulting in an ambiguity. However, the C/C++ compiler
does not generate an error message in this situation, as demonstrated by the
sample code in the "MORE INFORMATION" section, below. STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
REFERENCES "The Annotated C++ Reference Manual" (ARM), Ellis and
Stroustrup, Section 12.3.2, "Conversion Functions."
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbBug kbCompiler kbCPPonly KB116487 |
---|
|