Bug 9869 – invariant problem in template Class

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2013-04-03T12:59:20Z
Last change time
2024-12-13T18:05:49Z
Assigned to
No Owner
Creator
cbr
Moved to GitHub: dmd#18556 →

Attachments

IDFilenameSummaryContent-TypeSize
1205test_painter.dthis show the invariant problemtext/x-dsrc7045

Comments

Comment #0 by udefranettet — 2013-04-03T12:59:20Z
Created attachment 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.
Comment #1 by bearophile_hugs — 2013-04-03T14:12:08Z
Are you able to reduce the test case some more?
Comment #2 by k.hara.pg — 2013-04-03T20:59:55Z
(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; ...
Comment #3 by robert.schadek — 2024-12-13T18:05:49Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18556 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB