FIX: Invalid C2556 Error Generated by C/C++ 7.0
PSS ID Number: Q103723
Article last modified on 07-14-1994

7.00

MS-DOS


----------------------------------------------------------------------
The information in this article applies to:

 - Microsoft C/C++ for MS-DOS, version 7.0
----------------------------------------------------------------------

SYMPTOMS
========

When you typedef a function pointer and specify default arguments, the
following error message is generated:

   error C2556 'GetFunctionPtr' : overloaded functions only differ by
                                  return type

RESOLUTION
==========

To work around the problem, change the typedef for the pointer so it
does not use a default argument.

STATUS
======

Microsoft has confirmed this to be a problem in C/C++ version 7.0.
This problem was corrected in C/C++ version 8.0, which is included
with Visual C++ for Windows.

Sample Code
-----------

/* Compile options needed: none
*/

typedef void ( *Ptr )( int arg1, int arg2 = 0 );

class CSample
{¬
    Ptr m_functionPtr;

public:
    Ptr GetFunctionPtr( ) {¬ return m_functionPtr; }
};

Additional reference words: 7.00
KBCategory: Tls
KBSubcategory: CPPIss

=============================================================================

Copyright Microsoft Corporation 1994.
