https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92261

            Bug ID: 92261
           Summary: syntax errors on __has_builtin (__has_builtin)
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

With GCC support for __has_builtin (PR 66970) implemented, I noticed a
difference between it and Clang for the following test case that Clang accepts
and evaluates to zero:

$ cat z.c && gcc -S -Wall z.c
int f (void)
{
  return __has_builtin (__has_builtin);
}
z.c: In function ‘f’:
z.c:3:38: error: missing '(' after "__has_builtin"
    3 |   return __has_builtin (__has_builtin);
      |                                      ^
z.c:3:25: error: macro "__has_builtin" requires an identifier
    3 |   return __has_builtin (__has_builtin);
      |                         ^~~~~~~~~~~~~
z.c:3:23: error: expected ‘;’ at end of input
    3 |   return __has_builtin (__has_builtin);
      |                       ^
      |                       ;
    4 | }
      |                        
z.c:4:1: error: expected declaration or statement at end of input
    4 | }
      | ^

Reply via email to