[Issue 2399] ICE(cgcod.c) on casting function to delegate

2014-04-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2399

Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

Version|1.044   |D1

--


[Issue 2399] ICE(cgcod.c) on casting function to delegate

2009-05-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2399


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

   Keywords||patch




--- Comment #3 from Don clugd...@yahoo.com.au  2009-05-15 14:35:46 PDT ---
The root cause is in cast.c, 
Expression *SymOffExp::castTo(Scope *sc, Type *t).
Casting from a function pointer to a delegate must be forbidden.
This patch also fixes Bug 2875.



   else if (tb-ty == Tdelegate  f-isNested())
{
e = new DelegateExp(loc, new IntegerExp(0), f);
e = e-semantic(sc);
   } 
+else if (tb-ty == Tdelegate) {
+error(Cannot cast from function pointer to delegate);
+return this;
+   }
else
{
e = new SymOffExp(loc, f, 0);
e-type = t;
}

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