www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1286] New: crash on invariant struct member function referencing globals

reply d-bugmail puremagic.com writes:

           Summary: crash on invariant struct member function referencing
           Product: D
           Version: 2.000
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: lutger.blijdestijn gmail.com

When an invariant member function of an invariant struct uses global or static
member variables, the compiler crashes. This happens only when this function is
invoked more than once. See the code below.

int bar;

struct Foo
    invariant int func()
        return bar;

void main()
    invariant(Foo) foo;
    printf("%d", foo.func());

    /* uncomment this line and the compiler aborts with:
       Assertion failure: 'ito->isInvariant()' on line 335 in file 'mtype.c'
    //printf("%d", foo.func());

Jun 23 2007
parent d-bugmail puremagic.com writes:

bugzilla digitalmars.com changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

------- Comment #1 from bugzilla digitalmars.com  2007-06-27 20:55 -------
Fixed dmd 2.001

Jun 27 2007