D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3263 - Cannot use tuple foreach arguments in an array literal
Summary: Cannot use tuple foreach arguments in an array literal
Status: RESOLVED DUPLICATE of issue 1064
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2009-08-25 01:13 UTC by Don
Modified: 2014-02-16 15:22 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 Don 2009-08-25 01:13:59 UTC
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 Shin Fujishiro 2010-10-27 15:23:44 UTC
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 ***