Bug 2134 – 'Symbol undefined' when array created from tuple is sliced and used in foreach
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2008-05-29T03:31:00Z
Last change time
2014-02-24T15:33:20Z
Keywords
rejects-valid
Assigned to
nobody
Creator
samukha
Comments
Comment #0 by samukha — 2008-05-29T03:31:02Z
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.