Re: Compiler bug or incorrect usage for pointer of Struct?

2018-01-14 Thread Heromyth via Digitalmars-d
On Sunday, 14 January 2018 at 14:12:55 UTC, Temtaime wrote: On Sunday, 14 January 2018 at 13:24:14 UTC, Heromyth wrote: On Sunday, 14 January 2018 at 08:05:34 UTC, Temtaime wrote: On Sunday, 14 January 2018 at 04:02:09 UTC, Heromyth wrote: On Saturday, 13 January 2018 at 14:11:23 UTC, H. S.

Re: Compiler bug or incorrect usage for pointer of Struct?

2018-01-14 Thread Temtaime via Digitalmars-d
On Sunday, 14 January 2018 at 13:24:14 UTC, Heromyth wrote: On Sunday, 14 January 2018 at 08:05:34 UTC, Temtaime wrote: On Sunday, 14 January 2018 at 04:02:09 UTC, Heromyth wrote: On Saturday, 13 January 2018 at 14:11:23 UTC, H. S. Teoh wrote: On Sat, Jan 13, 2018 at 12:22:17PM +, Heromyth

Re: Compiler bug or incorrect usage for pointer of Struct?

2018-01-14 Thread Heromyth via Digitalmars-d
On Sunday, 14 January 2018 at 08:05:34 UTC, Temtaime wrote: On Sunday, 14 January 2018 at 04:02:09 UTC, Heromyth wrote: On Saturday, 13 January 2018 at 14:11:23 UTC, H. S. Teoh wrote: On Sat, Jan 13, 2018 at 12:22:17PM +, Heromyth via Digitalmars-d wrote: [...]

Re: Compiler bug or incorrect usage for pointer of Struct?

2018-01-14 Thread Temtaime via Digitalmars-d
On Sunday, 14 January 2018 at 04:02:09 UTC, Heromyth wrote: On Saturday, 13 January 2018 at 14:11:23 UTC, H. S. Teoh wrote: On Sat, Jan 13, 2018 at 12:22:17PM +, Heromyth via Digitalmars-d wrote: [...] auto writerFor(OutRange)(auto ref OutRange outRange) { auto res =

Re: Compiler bug or incorrect usage for pointer of Struct?

2018-01-13 Thread Heromyth via Digitalmars-d
On Saturday, 13 January 2018 at 14:11:23 UTC, H. S. Teoh wrote: On Sat, Jan 13, 2018 at 12:22:17PM +, Heromyth via Digitalmars-d wrote: [...] auto writerFor(OutRange)(auto ref OutRange outRange) { auto res = Writer!(OutRange)(); res.setSink(outRange); return res; } struct

Re: Compiler bug or incorrect usage for pointer of Struct?

2018-01-13 Thread H. S. Teoh via Digitalmars-d
On Sat, Jan 13, 2018 at 12:22:17PM +, Heromyth via Digitalmars-d wrote: [...] > auto writerFor(OutRange)(auto ref OutRange outRange) > { > auto res = Writer!(OutRange)(); > res.setSink(outRange); > return res; > } > > struct Writer(OutRange) > { > private OutRange* output; >

Re: Compiler bug or incorrect usage for pointer of Struct?

2018-01-13 Thread Temtaime via Digitalmars-d
On Saturday, 13 January 2018 at 12:22:17 UTC, Heromyth wrote: When executing the test code, it will exit abnormally. It seems *this.output* is pointing a free memory when executing *writer.write(dom)*. I'm not sure whether there is a bug in the compiler. If it is, I can file a bug. If not,

Compiler bug or incorrect usage for pointer of Struct?

2018-01-13 Thread Heromyth via Digitalmars-d
When executing the test code, it will exit abnormally. It seems *this.output* is pointing a free memory when executing *writer.write(dom)*. I'm not sure whether there is a bug in the compiler. If it is, I can file a bug. If not, somebody can tell me how to fix this. Thanks! Here is my test