void addOp(void* delegate() impl) { } static this() { addOp({ return new B(); }); } $ gdc -I. -O3 -g3 -frelease -c -o veclist.o veclist.d veclist.d:5: Error: undefined identifier B cc1d: /usr/src/gcc-4.7/gcc-4.7-4.7.2/src/gcc/d/dfrontend/cast.c:1727: virtual Expression* FuncExp::inferType(Type*, int, TemplateParameters*): Assertion `typen->deco' failed. cc1d: internal compiler error: Aborted Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. This error seems very dependent on the exact compilation flags; replacing -frelease with -funittest, for example, *seems* to make it go away. But I suspect the problem is still there; it just doesn't show up. This is the same bug that I posted about on the forum; I was unable to reduce it last time because I was running with -funittest, and past a certain code size the problem becomes hidden. Furthermore, I found that separate compilation vs. bulk compilation isn't the real issue; separate compilation with -frelease also triggers this bug. Also, the undefined identifier B in the original code is actually defined (under a different name, the exact name doesn't appear to matter -- the void* was originally a base class of B). But the problem seems to disappear upon reduction unless I keep an undefined identifier there. So this bug is NOT merely a problem with undefined identifiers, in the original code it's defined but still ICE's. During the early stages of code reduction, the above ICE was randomly alternating with a memory corruption error. I couldn't isolate the memory corruption, but I did manage to isolate the typen->deco ICE.
Hmm. I managed to reproduce the bug with minimal command-line arguments: gdc -c veclist.d also produces the ICE.
looks like an FE bug. Did you try DMD 2.060 first?
This problem doesn't happen on DMD (or at least, it doesn't manifest itself), that's why I reported it against GDC instead of DMD. I just tried dmd 2.060 and it seems fine.
(In reply to comment #3) > This problem doesn't happen on DMD (or at least, it doesn't manifest itself), > that's why I reported it against GDC instead of DMD. I just tried dmd 2.060 and > it seems fine. Right, now try it with 2.059. :-)
You're right, this bug is in dmd 2.059.