FIX: Missing '::' in Error C2579 for Ambiguous Overload

Last reviewed: September 18, 1997
Article ID: Q131203
2.00 2.10 WINDOWS NT kbtool kbfixlist

The information in this article applies to:

  • The Microsoft C/C++ Compiler (CL.EXE) included with: Microsoft Visual C++, 32-bit Edition, versions 2.0 and 2.1

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
};


Additional reference words: 2.00 2.10 8.0 8.00 8.0c 8.00c 9.0 9.00 9.1
9.10
KBCategory: kbtool kbfixlist kbbuglist
KBSubcategory: CPPIss
Keywords : CPPIss kbbuglist kbfixlist kbtool
Version : 2.00 2.10
Platform : NT WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.