Issue 14014 - struct init required for zero initialized static arrays
Summary: struct init required for zero initialized static arrays
Status: RESOLVED DUPLICATE of issue 14992
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All Linux
: P1 normal
Assignee: No Owner
URL: http://forum.dlang.org/thread/ibmdevy...
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-20 09:07 UTC by Martin Nowak
Modified: 2015-09-14 03:10 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Nowak 2015-01-20 09:07:30 UTC
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 Steven Schveighoffer 2015-01-20 14:27:33 UTC
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 Kenji Hara 2015-09-11 07:28:51 UTC
I think this is a dup of issue 14992.
Comment 3 Kenji Hara 2015-09-14 03:10:59 UTC

*** This issue has been marked as a duplicate of issue 14992 ***