[Issue 1190] Reference becoming null

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 4 09:43:53 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1190





------- Comment #8 from wbaxter at gmail.com  2007-09-04 11:43 -------
This seems to be a bad interaction between inout parameters and a tangly web of
pointers.  In your case, I don't think you need to pass the TreeNode by
reference (inout) to split, because nowhere in that function is the parameter
assigned to directly.  So I think just removing "inout" on that function will
fix your problem.  (I got another error after removing it, but it got past the
trouble spot).

But this still may be a bug.
You've got a graph like this basically:

                   bNeigh----->    
    null<---rNeigh[root]      [tree]bNeigh---> null
                       <------rNeigh

and you pass in root.bNeigh by reference, then you try to set
tree.rNeigh.bNeigh, which is the same as tree.  

I'll attach a simplified test case.


-- 



More information about the Digitalmars-d-bugs mailing list