C1001: Internal Compiler Error: pgoMD.c, Line 1467

ID Number: Q46379

5.10 | 5.10

MS-DOS | OS/2

buglist5.10 fixlist6.00

Summary:

Using a structure as the conditional argument of a ternary expression

causes an internal compiler error in Microsoft C version 5.1 if the

structure contains three or more elements. Compiling the sample code

below generates the following error:

fatal error C1001: Internal Compiler Error

(compiler file '@(#)pgoMD.c:1.134', line 1467)

Contact Microsoft Technical Support

The ternary operator, as defined in the "Microsoft C Version 5.1

User's Guide," accepts three operands. The conditional operand is

required by Microsoft C to be of type integral, float, or pointer. Any

other type (including struct) is undefined.

If the structure contains less than three elements, no error is

produced but the code will be undefined.

To work around the problem, use an if statement with appropriate

assignments rather than the conditional operator.

Microsoft has confirmed this to be a problem in C version 5.1. This

problem was corrected in C version 6.0.

Sample Code

-----------

/* Compile options needed: none

*/

#include <stdio.h>

struct { int a;

int b;

int c; } s;

void main(void)

{

printf("the value %d\n", s ? 1 : 2);

}