BUG: Function Defined in Local Class Causes C1001 |
Q115856
The code shown below will generate the following errors on computers running MS-DOS:
These errors are expected.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 statement
fatal error C1001: internal compiler error
(compiler file 'msc1.cpp', line 585)
To resolve the problem in the sample code below, declare zot as a global variable.
Microsoft 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.
The following sample can be used to demonstrate this problem.
/* 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 query words: 1.50 8.00c
Keywords : kb16bitonly
Issue type : kbbug
Technology : kbVCsearch kbAudDeveloper kbCVCComp
|
Last Reviewed: May 8, 2001 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |