[Issue 9869] invariant problem in template Class

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 3 20:59:57 PDT 2013


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



--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> 2013-04-03 20:59:55 PDT ---
(In reply to comment #0)
> Created an attachment (id=1205) [details]
> this show the invariant problem
> 
> The code example below is a cut down version of a larger code.
> 
> The code was written for in D1 and is now converted to D2.
> 
> In D1 the invariant test passed but in D2 it does not DMD 2.060 2.061 2.062.
> 
> The problem occurs in the this() member of Plane. 
> In line 293 of test_painter.d the pl_bottom private member function is
> initialized and it fails in the invariant line 336.
> 
> A debugger (gdb) show that the invariant function is called even when a private
> member is initialized.
> 
> Maybe invariant function has changed meaning in D2 but then I don't know how to
> use invariant in D2.
> 
> I have tried to put the private keyword in front of the invariant but it
> doesn't seem to have any effect on the invariant.
> 
> I except that invariant is like unittest so they a kind of private
> 
> Thank you for the good work you are doing.

After quick seeing: I think you confuse ti_lb and ti_bl ?

Inside Plane.this():
    ...
    pl_bottom.ti_lb = TileT.badTile;
    pl_bottom.ti_bl = pl_left;
    ...

-- 
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