diff --git a/compiler/src/dmd/link.d b/compiler/src/dmd/link.d index a04d4401ae4c..99823757f632 100644 --- a/compiler/src/dmd/link.d +++ b/compiler/src/dmd/link.d @@ -1196,7 +1196,7 @@ public int runPreprocessor(Loc loc, const(char)[] cpp, const(char)[] filename, c // need to redefine some macros in importc.h argv.push("-Wno-builtin-macro-redefined"); - if (target.os == Target.OS.OSX) + version (OSX) { argv.push("-fno-blocks"); // disable clang blocks extension argv.push("-E"); // run preprocessor only for clang diff --git a/compiler/test/compilable/test23356.c b/compiler/test/compilable/test23356.c new file mode 100644 index 000000000000..e1fc0c63ea37 --- /dev/null +++ b/compiler/test/compilable/test23356.c @@ -0,0 +1,14 @@ +// DISABLED: win linux freebsd openbsd netbsd dragonflybsd hurd +// REQUIRED_ARGS: -os=linux +// If clang is invoked improperly as a preprocessor, +// then this will fail to compile and link due to `__check` being undefined. +// If clang is invoked properly as a preprocessor then this will succeed +// as clang won't attempt to compile nor link the file. + +// https://github.com/dlang/dmd/issues/23356 + +int main(void) +{ + __check(1); + return 0; +}