Thread overview
[Issue 9869] New: invariant problem in template Class
Apr 03, 2013
cbr
Apr 04, 2013
Kenji Hara
April 03, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9869

           Summary: invariant problem in template Class
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: udefranettet@gmail.com


--- Comment #0 from cbr <udefranettet@gmail.com> 2013-04-03 12:59:20 PDT ---
Created an attachment (id=1205)
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 03, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9869


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #1 from bearophile_hugs@eml.cc 2013-04-03 14:12:08 PDT ---
Are you able to reduce the test case some more?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9869



--- Comment #2 from Kenji Hara <k.hara.pg@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: -------