Bug 13089 – Spurious 'is not nothrow' error on static array initialization

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-10T14:17:17Z
Last change time
2017-12-18T22:58:18Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Kenji Hara

Comments

Comment #0 by k.hara.pg — 2014-07-10T14:17:17Z
This code will report following error: struct S { @disable this(this); // non nothrow } void* p; S[1000] foo() nothrow { typeof(return) data; p = &data; return data; } void main() nothrow { immutable data = foo(); assert(p == &data); } ----- test.d(16): Error: 'test.S.__postblit' is not nothrow test.d(14): Error: function 'D main' is nothrow yet may throw But, if you comment out @disabled postblit in S, the code runs successfully and the static array value that foo returned is not copied. Therefore, the error "'test.S.__postblit' is not nothrow" is spurious.
Comment #1 by k.hara.pg — 2014-07-10T14:35:44Z
Comment #2 by github-bugzilla — 2014-07-20T05:52:55Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/60ae165eb1ea2980c0b57a82c035a36d4f8f0176 fix Issue 13089 - Spurious 'is not nothrow' error on static array initialization https://github.com/D-Programming-Language/dmd/commit/a4c76af062d11fbe465ae5a85eb9c0d23c7d4620 Merge pull request #3738 from 9rnsr/fix13089 Issue 13089 - Spurious 'is not nothrow' error on static array initialization
Comment #3 by github-bugzilla — 2014-07-23T15:35:35Z
Commit pushed to 2.066 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/82a80a9ebbc30e894d9fe01ae55e6d8145aae24b Merge pull request #3738 from 9rnsr/fix13089 Issue 13089 - Spurious 'is not nothrow' error on static array initialization
Comment #4 by github-bugzilla — 2014-08-22T08:04:47Z
Comment #5 by github-bugzilla — 2017-12-10T21:56:46Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/404c11c8470c90f05d70c202d65b52fe326ed0d7 Add field to give struct used in testing issue 13089 a size. https://github.com/dlang/dmd/commit/c6829a8d2374dd9398e763ede1f4377482688942 Merge pull request #7417 from ibuclaw/emptyaggr Add field to give struct used in testing issue 13089 a size. merged-on-behalf-of: Mike Franklin <[email protected]>
Comment #6 by github-bugzilla — 2017-12-18T22:58:18Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/404c11c8470c90f05d70c202d65b52fe326ed0d7 Add field to give struct used in testing issue 13089 a size. https://github.com/dlang/dmd/commit/c6829a8d2374dd9398e763ede1f4377482688942 Merge pull request #7417 from ibuclaw/emptyaggr