[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 01:53:51 PDT 2009
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=874
Don <clugdbug at yahoo.com.au> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Incorrect codegen with      |Bad codegen: wrong value
                   |tuples, string constants,   |variable in tuple foreach,
                   |and AAs, D1 only            |D1 only
--- Comment #3 from Don <clugdbug at yahoo.com.au> 2009-10-30 01:53:50 PDT ---
Original title was: "Incorrect codegen with tuples, string constants, and AAs".
This bug has nothing to do with AAs, actually. The problem is that the 'value'
in a tuple foreach isn't dealt with correctly. 
Workarounds: Change the code into:  ret = arg.dup; or ret = args[0];
char[] bug874(T...)(T args)
{
    char[] ret;
    foreach(arg; args) {
        ret = arg;
    }
    assert(ret=="b"); // passes
    return ret;
}
void main()
{
    char[] s = bug874("b");
    assert(s == "b"); // fails
}
-- 
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