D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 14992 - static array local variables always require .init
Summary: static array local variables always require .init
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: link-failure, pull
: 14014 (view as issue list)
Depends on:
Blocks: 14918
  Show dependency treegraph
 
Reported: 2015-09-01 09:28 UTC by Vladimir Panteleev
Modified: 2016-03-19 20:21 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Vladimir Panteleev 2015-09-01 09:28:03 UTC
//// a.d ////
import b;

void main()
{
    S[1] arr;
}
//// b.d ////
struct S {}
/////////////

This doesn't link:

 Error 42: Symbol Undefined _D1b1S6__initZ

Using individual (non-array) variables of type S, as well as making the array static, seem to fix the linker error.
Comment 2 Kenji Hara 2015-09-14 03:10:59 UTC
*** Issue 14014 has been marked as a duplicate of this issue. ***
Comment 3 github-bugzilla 2016-02-07 02:21:13 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/e2be39899a71f1d82d8d23ebf52c97f8efb13485
fix Issue 14992 - static array local variables always require .init

Add one more special case for static array of struct initialization with zero, similar to the special case for struct initialization.

https://github.com/D-Programming-Language/dmd/commit/8388211efea46340e1ada6b3b889452efd40ccd5
Merge pull request #5014 from 9rnsr/fix14992

Issue 14992 - static array local variables always require .init
Comment 4 github-bugzilla 2016-03-19 20:21:53 UTC
Commits pushed to stable at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/e2be39899a71f1d82d8d23ebf52c97f8efb13485
fix Issue 14992 - static array local variables always require .init

https://github.com/D-Programming-Language/dmd/commit/8388211efea46340e1ada6b3b889452efd40ccd5
Merge pull request #5014 from 9rnsr/fix14992