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:
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 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:
http://d.puremagic.com/issues/show_bug.cgi?id=1286


bugzilla digitalmars.com changed:

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





Fixed dmd 2.001


-- 
Jun 27 2007