diff --git a/changelog/dmd.import-c-i.dd b/changelog/dmd.import-c-i.dd new file mode 100644 index 0000000000..00a1421a33 --- /dev/null +++ b/changelog/dmd.import-c-i.dd @@ -0,0 +1,3 @@ +Using the compiler flag `-i` will now properly pick up C source files + +Previously you needed to manually include .c source files, it now works just like with .d files diff --git a/compiler/src/dmd/compiler.d b/compiler/src/dmd/compiler.d index d2bedc9959..e01462ba5e 100644 --- a/compiler/src/dmd/compiler.d +++ b/compiler/src/dmd/compiler.d @@ -138,7 +138,7 @@ extern (C++) struct Compiler */ extern(C++) static bool onImport(Module m) { - if (includeImports && m.filetype == FileType.d) + if (includeImports && (m.filetype == FileType.d || m.filetype == FileType.c)) { if (includeImportedModuleCheck(ModuleComponentRange( m.md ? m.md.packages : [], m.ident, m.isPackageFile))) diff --git a/compiler/test/compilable/test16776.d b/compiler/test/compilable/test16776.d new file mode 100644 index 0000000000..9ebd515d8b --- /dev/null +++ b/compiler/test/compilable/test16776.d @@ -0,0 +1,8 @@ +// ARG_SETS: -i +// PERMUTE_ARGS: +// LINK: +import imports.cstuff3; +void main() +{ + int s = squared(2); +}