www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9869] New: invariant problem in template Class

reply d-bugmail puremagic.com writes:
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



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: -------
Apr 03 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9869


bearophile_hugs eml.cc changed:

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



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: -------
Apr 03 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9869





 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: -------
Apr 03 2013