Bug 14014 – struct init required for zero initialized static arrays
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2015-01-20T09:07:00Z
Last change time
2015-09-14T03:10:59Z
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2015-01-20T09:07:30Z
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).
Comment #1 by schveiguy — 2015-01-20T14:27:33Z
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.
Comment #2 by k.hara.pg — 2015-09-11T07:28:51Z
I think this is a dup of issue 14992.
Comment #3 by k.hara.pg — 2015-09-14T03:10:59Z
*** This issue has been marked as a duplicate of issue 14992 ***