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

            Bug ID: 115488
           Summary: __has_include with empty filename
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

#if __has_include("")
#endif
#if __has_include(<>)
#endif
#include ""
#include <>

gcc emits errors just about the last 2 lines, while clang diagnoses also the
__has_include.
C23 says in 6.10.1/6:
"Such a directive shall satisfy the syntactic requirements of a #include
directive."
and I believe it is the syntax requirement of #include that the headers are
non-empty:
# include < h-char-sequence > new-line
# include " q-char-sequence " new-line
h-char-sequence:
  h-char
  h-char-sequence h-char
q-char-sequence:
  q-char
  q-char-sequence q-char
and so I think <> nor "" aren't valid.

Reply via email to