Re: Something wrong with reflection inside struct destructor

2017-03-14 Thread Jack Applegame via Digitalmars-d
On Tuesday, 14 March 2017 at 14:33:49 UTC, John Colvin wrote: bug report? https://issues.dlang.org/show_bug.cgi?id=17257

Re: Something wrong with reflection inside struct destructor

2017-03-14 Thread John Colvin via Digitalmars-d
On Tuesday, 14 March 2017 at 13:38:52 UTC, Jack Applegame wrote: On Tuesday, 14 March 2017 at 12:44:16 UTC, Jack Applegame wrote: Workaround: Avoid reflection in the destructor. Do reflection in normal function and then call it from destructor. This doesn't work -

Re: Something wrong with reflection inside struct destructor

2017-03-14 Thread Jack Applegame via Digitalmars-d
This is completely unacceptable: DPaste(https://dpaste.dzfl.pl/f54f578c4ec9) import std.stdio; import std.string; import std.experimental.allocator; import std.experimental.allocator.mallocator : Mallocator; struct Bar(E) { E* ptr = null; void allocate(int m) { ptr =

Re: Something wrong with reflection inside struct destructor

2017-03-14 Thread Jack Applegame via Digitalmars-d
On Tuesday, 14 March 2017 at 12:44:16 UTC, Jack Applegame wrote: Workaround: Avoid reflection in the destructor. Do reflection in normal function and then call it from destructor. This doesn't work - https://dpaste.dzfl.pl/5a1d93f7a277 Call from destructor changes compiler behavior. This is

Something wrong with reflection inside struct destructor

2017-03-14 Thread Jack Applegame via Digitalmars-d
I'm trying to write reference counted dynamic array and encountered a trouble with compile time reflection at recursive template instantiation. for dynamic arrays (and AA too) it is normal to use recursive declarations: struct S { S[] arr; } struct S { Array!S arr; } Look at this