unittest affects next unittest
Jonathan M Davis via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Aug 1 23:45:29 PDT 2014
On Fri, 01 Aug 2014 23:09:37 +0000
sigod via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:
> Code: http://dpaste.dzfl.pl/51bd62138854
> (It was reduced by DustMite.)
>
> Have I missed something about structs? Or this simply a bug?
Don't do this with a member variable:
private Node * _root = new Node();
Directly initializing it like that sets the init value for that struct, and
that means that every struct of that type will have exactly the same value for
_root, so they will all share the same root rather than having different
copies. You need to initialize _root in the constructor.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list