https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64965
Bug ID: 64965 Summary: __FILE__ doesn't work if the filename contains newline Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor Assignee: unassigned at gcc dot gnu.org Reporter: rv at rasmusvillemoes dot dk While trying to come up with test cases for a bug in the static analyzer sparse, I tried to see how gcc did in some corner cases. Turns out that using __FILE__ in a file whose name contains a newline character causes file newline.c:1:1: warning: missing terminating " character static const char s[] = __FILE__; ^ file newline.c:1:25: internal compiler error: invalid built-in macro "__FILE__" static const char s[] = __FILE__; While I don't really care about file names with weird characters, gcc could issue a better diagnostic than 'internal compiler error' :-) OTOH, it's probably just as much work making it DTRT, though I don't have time for diving into the sources right now.