D-ark corners - algorithms, ranges, and auto ref - best practices guides.

ag0aep6g anonymous at example.com
Tue Jul 23 15:22:37 UTC 2019


On 23.07.19 15:51, aliak wrote:
> Hi, I recently ran in to a problem with stack corruption [0].
[...]
> Anyway, this is what I narrowed it down to eventually in client code.
> 
> @safe:
> auto foundValue = makeRange("one")
>    .algorithm;
> useValue(foundValue); // BOOM
[...]
> And finally, I've been keeping note of various gotchas in D, and traps, 
> etc [1] and I'm wondering if anyone else takes note of these things? Can 
> you post links to them here if you do?
[...]
> [0]: https://forum.dlang.org/thread/hhxabgmrwvqvmezezyym@forum.dlang.org
> [1]: https://github.com/aliak00/d-isms/tree/master/da-faq

If that code leads to memory corruption, it shouldn't compile as @safe. 
You're looking at a compiler bug, not a gotcha.

Might already be filed here:
https://issues.dlang.org/show_bug.cgi?id=17927


More information about the Digitalmars-d mailing list