[Issue 3426] New: ICE(optimize.c): struct literal with cast, as function default parameter.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 20 12:17:44 PDT 2009


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

           Summary: ICE(optimize.c): struct literal with cast, as function
                    default parameter.
           Product: D
           Version: 1.020
          Platform: All
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code, patch
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


--- Comment #0 from Don <clugdbug at yahoo.com.au> 2009-10-20 12:17:43 PDT ---
An ancient bug: same ICE on D1.020 as on D2.036
TEST CASE:

struct Ashes {
    int ashes = cast(int)0;
}
void funky (Ashes s = Ashes()) {}

void funk() {
   funky();
}


PATCH: This patch also fixes the closely related bug 3422.
 (The semantic is for this bug. The implicit cast is for bug 3422.
The assert is just a precaution).
expression.c line 3271.

        {    e = v->type->defaultInit();
        e->loc = loc;
        }
        offset = v->offset + v->type->size();
    }
+   assert(v->type);    
+    e= e->semantic(sc);
+    if (e->type !=v->type) e = e->implicitCastTo(sc, v->type);
    elements->push(e);
    }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list