cat > foo.di << CODE struct Foo {} CODE cat > bug.d << CODE import foo; void main() { Foo[2] foo; } CODE dmd bug ---- bug.o:bug.d:function _Dmain: error: undefined reference to '_D3foo3Foo6__initZ' ---- This is a problem for header only libraries (and some modules in druntime).
In addition to this, we should probably not generate ModuleInfo when it's not needed. The reason this came about is because a module that is basically import-only was not included in druntime. But you could not compile code that used the included struct. The rationale of avoiding including it in druntime build was to avoid adding unnecessary ModuleInfo bloat. It would be nice if you could include it and the bloat wasn't added if the compiler detected it didn't need it.
I think this is a dup of issue 14992.
*** This issue has been marked as a duplicate of issue 14992 ***