[Issue 1036] regression: invalid code generation for class literal expression unless -fPIC or -release is used

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 11 06:13:56 PDT 2007


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


dvdfrdmn at users.sf.net changed:

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




------- Comment #1 from dvdfrdmn at users.sf.net  2007-03-11 08:13 -------
Exiting from 'foo' invalidates the anonymous class' link to 'status'. The
correct way to do this is to have a direct pointer to the outer stack frame:

    return &(new class
        {
            int *p_status;
            this() { p_status = & status; }
            int dg() {
                return ++ *p_status;
            }
        }
         ).dg;


-- 



More information about the D.gnu mailing list