BUG: C1001: grammar.c, Line 155, Constructor Argument ListID: Q100966
|
An attempt to compile, with the optimizing compiler, a class constructor that accepts a variable number of arguments fails and Microsoft C/C++ generates the following message:
Depending on the complexity of the source code, the error may occur on line 156, 179, or 180 in GRAMMAR.C, rather than on line 155. The error occurs regardless of the specified optimizations.test.cpp(20) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file '@(#)grammar.c:1.147', line 155) Contact Microsoft Product Support Services
test.cpp(20) : warning C4713: _aab: INTERNAL COMPILER ERROR; restarting (compiler file '@(#)grammar.c:1.147', line 155) Contact Microsoft Product Support Services
This error is caused by a problem optimizing the variable argument list in the class constructor. The error occurs only for the actual constructor call (not for the declaration), and occurs only when the number of arguments exceeds a limit that varies depending on the complexity of the code. In the sample code below, the error occurs when the constructor call specifies between 53 and 98 arguments. If the call specifies fewer than 53 arguments, no error occurs. If the call specifies more than 98 arguments, the compiler generates the following warning message:
test.cpp(20) : fatal error C1035: expression too complex; simplify expression
To address this situation, perform one of the following two steps:
Microsoft has confirmed this to be a problem in C/C++ versions 7.0, 7.0a,
and 8.0 for MS-DOS. We are researching this problem and will post new
information here in the Microsoft Knowledge Base as it becomes available.
This problem does not occur with C/C++ 32-bit compiler versions 8.0 or 9.0,
included with Visual 32-bit Edition, versions 1.0 and 2.0, because the /f
option is not supported.
The following code example demonstrates this error when you compile it with the optimizing compiler (using the specified options):
/*
* Compile options needed: /c /f-
*/
#include <stdarg.h> // Required for code that uses
// variable number of arguments
class N
{
public:
N(int ar, ...) {}
};
static const N title(1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1, 2, 3, 4, 5, 6, 7, 8, 9, 20,
1, 2, 3, 4, 5, 6, 7, 8, 9, 30,
1, 2, 3, 4, 5, 6, 7, 8, 9, 40,
1, 2, 3, 4, 5, 6, 7, 8, 9, 50,
1, 2, 3, 4, 5, 6, 7, 8, 9, 60,
1, 2, 3, 4, 5, 6, 7, 8, 9, 70,
1, 2, 3, 4, 5, 6, 7, 8, 9, 80,
1, 2, 3, 4, 5, 6, 7, 8, 9, 90,
1, 2, 3, 4, 5, 6, 7, 8
);
Additional query words: 1.00 1.50 7.00 7.00a 8.00 8.00c
Keywords : kb16bitonly
Version :
Platform :
Issue type :
Last Reviewed: July 21, 1999