[Issue 874] Bad codegen: wrong value variable in tuple foreach, D1 only

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 30 02:16:23 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=874


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #4 from Don <clugdbug at yahoo.com.au> 2009-10-30 02:16:21 PDT ---
Looks like this is just a D2 fix which didn't get transferred across to D1.
PATCH (against DMD1 svn 227):
expression.c, ForeachStatement::semantic, line 1380.

        // Declare value
        if (arg->storageClass & (STCout | STCref | STClazy))
        error("no storage class for value %s", arg->ident->toChars());
        Dsymbol *var;
        if (te)
-        {
-        if (e->type->toBasetype()->ty == Tfunction &&
-            e->op == TOKvar)
+        {    Type *tb = e->type->toBasetype();
+        if ((tb->ty == Tfunction || tb->ty == Tsarray) && e->op == TOKvar)
        {   VarExp *ve = (VarExp *)e;
            var = new AliasDeclaration(loc, arg->ident, ve->var);
        }

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


More information about the Digitalmars-d-bugs mailing list