D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2134 - 'Symbol undefined' when array created from tuple is sliced and used in foreach
Summary: 'Symbol undefined' when array created from tuple is sliced and used in foreach
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2008-05-29 03:31 UTC by Max Samukha
Modified: 2014-02-24 15:33 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Max Samukha 2008-05-29 03:31:02 UTC
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.
Comment 1 Don 2009-09-23 05:27:38 UTC
Fixed sometime before 2.041.