Bug in std.container: SList

anonymous via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 14 11:12:40 PDT 2015


On Friday, 14 August 2015 at 16:28:39 UTC, Xinok wrote:
> I can confirm that this is a bug but I'm not sure what the 
> "correct" way is to fix it. SList creates a dummy node for the 
> root of the list, but because structs don't allow default 
> constructors, this dummy node is never allocated in the first 
> case. Either we can add lots of null checks to initialize the 
> list, or we can add this line:
>
> @disable this();
>
> Thoughts?

Other insert*  functions call the private function 
SList.initialize() which does the null-check for _root. I am 
working on a PR adding the missing call in insertAfter - that's a 
1 line change. I am not a phobos dev.



More information about the Digitalmars-d mailing list