FIX: Invalid C2597 Error Generated by C/C++ 7.0
PSS ID Number: Q104039
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 compile the sample code below, the Microsoft C/C++ 7.0
compiler generates the following error message:

   error C2597: 'CSample::m_int' : does not specify an object

CAUSE
=====

The error occurs because the typedef declaration does not have a tag
(identifier) for the structure. When this type is used as an argument
to the class member function, it produces the error.

RESOLUTION
==========

To avoid the error, you can add a tag for the structure in the typedef
declaration, similar to the following:

   typedef struct dummy_tag {¬ int value; } Anonymous;

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, included with Visual C++ for
Windows, version 1.0.

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

/* Compile options needed: none
*/

typedef struct {¬ int value; } Anonymous;  // Add struct tag to avoid C2597

class CSample
{¬
    int  m_int;

public:
    void MemberFunction( Anonymous arg ) {¬ m_int = 0; }
};

Additional reference words: 7.00
KBCategory: Tls
KBSubCategory: CPPIss

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

Copyright Microsoft Corporation 1994.
