FIX: C1001: getattr.c:1.89, Line 179, Incorrect __based Use
PSS ID Number: Q102364
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
========

An attempt to compile an application in the optimizing compiler
(specify the /f- compiler option switch) fails and Microsoft C/C++
version 7.0 generates the following message:

   file.cpp(13) : fatal error C1001: INTERNAL COMPILER ERROR
            (compiler file '@(#)getattr.c:1.89', line 179)
            Contact Microsoft Product Support Services

If you remove the /f- option switch and optionally add the /f or /qc
option switches, the code may compile without errors or warnings.

CAUSE
=====

The compiler does not support using the __based specifier with a non-
static member variable. The compiler should generate an appropriate
warning to this effect.

If you remove the /f- option switch and optionally add the /f or /qc
option switches, the compiler may generate incorrect code.

RESOLUTION
==========

An attempt to compile this code with C/C++ version 8.0 for MS-DOS,
which is included with Microsoft Visual C++ version 1.0 for Windows,
fails and the compiler generates the following message:

   C2293: 'seg': illegal to have a non-static member variable as a
           __based specifier

STATUS
======

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

MORE INFORMATION
================

The following code example demonstrates this problem:

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

/*
 * Compiler options needed: /f- /Od to demonstrate problem
 */

class ClassName
{
public:
   __segment seg;
   class subclass { };
   subclass __based(seg) *var;
};

ClassName __based(void) *Func(__segment cseg)
{
   ClassName __based(cseg) *localvar1;
   ClassName::subclass __based(cseg) *localvar2;

   localvar1->var = localvar2; // this line causes the error
   return localvar1;
}

Additional reference words: 7.00
KBCategory: Tls
KBSubCategory: CPPIss

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

Copyright Microsoft Corporation 1994.
