FIX: Missing '::' in Error C2579 for Ambiguous Overload (131203)



The information in this article applies to:

  • Microsoft Visual C++, 32-bit Professional Edition 2.0
  • Microsoft Visual C++, 32-bit Professional Edition 2.1

This article was previously published under Q131203

SYMPTOMS

A member function that is an ambiguous overload of another member function of the class causes the compiler to generate a correct C2579 error message to indicate that the parameter list is not sufficiently different to overload the function. This behavior is as it should be.

However, in the error message, the scope resolution operator (::) is missing between the class name and the function name used to indicate the problem. For example, compiling the sample code shown in article causes the compiler to generate this error :
   error C2579: 'TestClassTestFunc(int)' : parameter list not
                sufficiently different from
                'TestClassTestFunc(const int)'
					
The error should look like this:
   error C2579: 'TestClass::TestFunc(int)' : parameter list not
                sufficiently different from
                'TestClass::TestFunc(const int)'
					
This only happens with Visual C++, 32-bit Edition, versions 2.0 and 2.1. This does not happen with Visual C++ version 1.0 for Windows NT nor does it happen with the 16-bit versions of Visual C++.

NOTE: In Visual C++ 4.0, the text message of error C2579 has been corrected. It now appears as follows:
   error C2579: '<function_name>(<parameter_list1>)' :
      parameter list not sufficiently different from
      '<function_name>(<parameter_list2>)'
					

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Visual C++, 32-bit Edition, version 4.0.

MORE INFORMATION

Sample Code to Demonstrate Problem

/* Compiler Options: /c
*/ 

class TestClass
{
 public:
     void TestFunc(const int i) {};
     void TestFunc(int i) {};       // Expecting C2579
};
				

Modification Type:MinorLast Reviewed:7/5/2005
Keywords:kbbug kbCompiler kbCPPonly kbfix KB131203