[Issue 6761] Strange behavior of RedBlackTree causeing a dangling pointer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 3 09:05:29 PDT 2011


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


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Platform|x86                         |All
         AssignedTo|nobody at puremagic.com        |schveiguy at yahoo.com
         OS/Version|Linux                       |All


--- Comment #3 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-10-03 09:04:47 PDT ---
If you compile both modules without -unittest, the code works properly.  If you
compile the second file with unittest (even if the test code is in main()), the
code fails.

The reason is because the unit test version of RBT unintentionally has an extra
entry in the vtable when compared to the non-unittest version.  This was my
error, and I will submit a pull request to fix it.  The reason it didn't show
up when RedBlackTree was a struct is because structs don't have virtual
functions.

In order to get your code working, put final in front of the function
"arrayEqual".  i.e.:

final bool arrayEqual(T[] arr)

I'll close the bug when the pull request is implemented.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list