[Issue 1286] New: crash on invariant struct member function referencing globals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 23 07:53:19 PDT 2007


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

           Summary: crash on invariant struct member function referencing
                    globals
           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 at digitalmars.com
        ReportedBy: lutger.blijdestijn at 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());
}


-- 



More information about the Digitalmars-d-bugs mailing list