[Issue 2134] New: 'Symbol undefined' when array created from tuple is sliced and used in foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 29 01:31:03 PDT 2008


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

           Summary: 'Symbol undefined' when array created from tuple is
                    sliced and used in foreach
           Product: D
           Version: 1.030
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: samukha at voliacable.com


The error occurs only if $ (or length) is used to slice the array:

----
template Foo(A...)
{
    const Foo = cast(int[])[A]; // BTW, why is the cast required here?
}

void main()
{    
    foreach (i; Foo!(1, 2)[1 .. $])
    {
    }
}
----
Error 42: Symbol Undefined _D4test4mainFZv8__dollark

The error disappears if the array length is accessed explicitly or the test is
built with -release switch.


-- 



More information about the Digitalmars-d-bugs mailing list