https://issues.dlang.org/show_bug.cgi?id=22560
Issue ID: 22560 Summary: ImportC: extra semicolon not allowed outside of functions Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: dave287...@gmail.com Compilation fails if an extra semicolon is encountered outside of a function. For example: // semi.c ; // semi.c(1): Error: identifier or `(` expected int main(){return 0;} This is technically correct, but sometimes headers end up with extra semicolons at file scope after pre-processing if conditional type declarations are incorrectly guarded. For example, a header might use a function-like macro to declare a type, conditionally defining it to expand to nothing. Then they incorrectly put a semicolon after the function like macro. For example: #if SOME_CONDITION #define DECLARE(name) struct name #else #define DECLARE(name) #endif DECLARE(name); // this semicolon is incorrect if SOME_CONDITION is false Some headers on macOS have this incorrect pattern. GCC and clang both allow the extra semicolon at file scope. --