Article ID: 116487 - Last Review: July 5, 2005 - Revision: 3.1 BUG: No Compiler Error for Ambiguous C++ ConversionThis article was previously published under Q116487 On This PageSYMPTOMS 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.
MORE INFORMATION You can use the following sample code to reproduce this
problem: Sample CodeREFERENCES "The Annotated C++ Reference Manual" (ARM), Ellis and
Stroustrup, Section 12.3.2, "Conversion Functions." APPLIES TO
| Article Translations
|
Back to the top
