BUG: Function Defined in Local Class Causes C1001Last reviewed: July 22, 1997Article ID: Q115856 |
1.50
WINDOWS
kbtool kbbuglist
The information in this article applies to:
SYMPTOMSThe code shown below will generate the following errors on computers running MS-DOS:
error C2601: functions cannot be defined in local classes error C2517: 'C_char' : right of '::' is undefined error C2510: '' : left of '::' must be a class/struct/union error C2270: '.PAD' : modifiers not allowed on nonmember functions error C2065: 'storage' : undeclared identifier error C2440: 'return' : cannot convert from 'char __near *' to 'int ' error C2618: '.PAD' : inconsistent return statementThese errors are expected. On computers running Windows NT, the first two errors are generated by the, compiler, but the other errors are not. Instead, the following error is reported:
fatal error C1001: internal compiler error (compiler file 'msc1.cpp', line 585) RESOLUTIONTo resolve the problem in the sample code below, declare zot as a global variable.
STATUSMicrosoft has confirmed this to be a problem with the C/C++ compiler for MS-DOS, version 8.0c. We are researching the problem and will post new information here as it becomes available. This is not a problem with the 32-bit C/C++ compiler.
MORE INFORMATIONThe following sample can be used to demonstrate this problem.
Sample Code
/* Compile options needed: none */ #include <iostream.h> #define C(type) \ class C_ ## type { \ void* storage; \ public: \ operator type*() { return (type*)storage; } \ } // uncomment the following line and comment the same line // in f() to fix the problem // C(char) zot; void f(){ C(char) zot;}
void main ( void ){ cout << "PASSED" << endl;}
|
Additional reference words: 1.50 8.00c
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |