diff dmd/codegen/Util.d @ 135:af1bebfd96a4 dmd2037

dmd 2.038
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Mon, 13 Sep 2010 22:19:42 +0100
parents 60bb0fe4563e
children 31c086f76669
line wrap: on
line diff
--- a/dmd/codegen/Util.d	Sat Sep 11 13:03:39 2010 +0100
+++ b/dmd/codegen/Util.d	Mon Sep 13 22:19:42 2010 +0100
@@ -297,9 +297,15 @@
 			e = el_una(op,tyret,ep);
     }
     else if (ep)
-		e = el_bin((tf.ispure && tf.isnothrow) ? OPER.OPcallns : OPER.OPcall, tyret, ec, ep);
+	    /* Do not do "no side effect" calls if a hidden parameter is passed,
+	     * as the return value is stored through the hidden parameter, which
+	     * is a side effect.
+	     */
+		e = el_bin((tf.ispure && tf.isnothrow && (retmethod != RET.RETstack)) ?
+		            OPcallns : OPcall, tyret, ec, ep);
     else
-		e = el_una((tf.ispure && tf.isnothrow) ? OPER.OPucallns : OPER.OPucall, tyret, ec);
+		e = el_una((tf.ispure && tf.isnothrow && (retmethod != RET.RETstack)) ?
+		            OPucallns : OPucall, tyret, ec);
 
     if (retmethod == RET.RETstack)
     {