[Issue 15832] Crashing program when a helper template function is used to create a template struct

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Mar 28 06:19:28 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=15832

--- Comment #6 from ag0aep6g at gmail.com ---
(In reply to Atila Neves from comment #5)
> At least there's a workaround:
> 
> auto m = Mock!T(...);
> return m;
> 
> I believe that the fact that this behaviour is different from the original
> implementation is a compiler bug and would ask for this to reopened.

I'm not sure if it's strictly a bug (against the spec), or if you're relying on
an implementation detail when you assume construction at the destination.
Either way, I agree that it's weird how adding a temporary makes the copy go
away. I see a reasonable enhancement request, at least.

You can reopen issues yourself. However, in this case I think we better open a
new one. Did that here: issue 15842. I've added you to the CC list.

> Also, the memory corruption that resulted from my original implementation
> goes well beyong a delegate referencing gargabe. It was really weird.

If there's anything else going on, could you provide a test case where that's
more obvious? Or maybe point out how the additional corruption is visible in
the code samples we have so far.

--


More information about the Digitalmars-d-bugs mailing list