http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60570

            Bug ID: 60570
           Summary: expression in 'elif' directive mis-diagnosed as error
                    when group will be skipped
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: seb.grindle at gmail dot com

Consider the following C99 program:

#if 1
int i;
#elif 1/0
#endif

With gcc 4.7.3:

   gcc -c test.c

we get

   test.c:3:8: error: division by zero in #if

According to 6.10.1p5, any sequence of tokens between the #elif and the newline
is valid syntax since the group for which this line is the controlling
condition will be skipped, yet gcc emits a divide by zero error.

(I don't know if this bug is present in later versions as 4.7.3 is the latest I
have tested on.)

Seb

Reply via email to