Bug 3263 – Cannot use tuple foreach arguments in an array literal
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
Other
OS
Windows
Creation time
2009-08-25T01:13:00Z
Last change time
2014-02-16T15:22:26Z
Keywords
rejects-valid
Assigned to
nobody
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2009-08-25T01:13:59Z
This is the second bug report in bug #1298, which is completely unrelated to the first one.
----
template Foo(Strings...)
{
const a2 = [Strings];
}
alias Foo!("one", "two") foo;
// Error: cannot implicitly convert expression (tuple("one","two")) of type (char[3], char[3]) to char
Comment #1 by rsinfu — 2010-10-27T15:23:44Z
Expansion works inside dynamic array literals, but doesn't inside array initializers. The following works (both D1 & D2):
template Foo(Strings...)
{
const a2 = ([Strings])[]; // as an array literal
}
alias Foo!("one", "two") foo;
*** This issue has been marked as a duplicate of issue 1064 ***