Commits

Iain Buclaw committed e37f417

Pass static chain by reference for functions nested in classes.

Comments (0)

Files changed (1)

 elem *
 CastExp::toElem(IRState * irs)
 {
-    if (e1->op == TOKcall && to->ty == Tvoid)
+    if (to->ty == Tvoid)
     {   // Just evaluate e1 if it has any side effects
         return build1(NOP_EXPR, void_type_node, e1->toElem(irs));
     }
                     }
                     else
 #endif
-                    {
-                        static_chain_expr = t;
+                    {   /* Pass chain by reference. */
+                        static_chain_expr = irs->addressOf(t);
                     }
                     break;
                 }
     irs->startScope();
     irs->doLineNote(loc);
 
+#if D_NO_TRAMPOLINES
     if (static_chain_expr)
     {
         cfun->custom_static_chain = 1;
 
     buildClosure(irs); // may change irs->closureLink and irs->closureFunc
 #endif
+#endif
 
     if (vresult)
         irs->emitLocalVar(vresult);
 void
 EnumDeclaration::toDebug()
 {
+    TypeEnum * tc = (TypeEnum *)type;
+    if (!tc->sym->defaultval || type->isZeroInit())
+        return;
+
     tree ctype = type->toCtype();
     rest_of_type_compilation(ctype, /*toplevel*/1);
 }