diff dmd/expression.h @ 1168:ab186e535e72

A different fix to #218 and DMD2682 that does not lead to constant folding regressions. Fixes run/const_15, run/c/const_16_B. The price is removing the lvalueness of struct literals. If it turns out too much code depends on this behavior or we don't want to break with DMD, we could keep struct literals as lvalues and instead convert struct literals used as expression initializers into struct initializers.
author Christian Kamm <kamm incasoftware de>
date Sun, 29 Mar 2009 11:43:45 +0200
parents 521dd1626d76
children e961851fb8be
line wrap: on
line diff
--- a/dmd/expression.h	Sat Mar 28 21:10:53 2009 +0100
+++ b/dmd/expression.h	Sun Mar 29 11:43:45 2009 +0200
@@ -502,7 +502,9 @@
     void scanForNestedRef(Scope *sc);
     Expression *optimize(int result);
     Expression *interpret(InterState *istate);
-    Expression *toLvalue(Scope *sc, Expression *e);
+    // LDC: struct literals aren't lvalues! Taking their address can lead to 
+    //      incorrect behavior, see LDC#218, DMD#2682
+    // Expression *toLvalue(Scope *sc, Expression *e);
 
     int inlineCost(InlineCostState *ics);
     Expression *doInline(InlineDoState *ids);