D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3451 - (D1 only) Initializers don't work for tuple variables
Summary: (D1 only) Initializers don't work for tuple variables
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: diagnostic, rejects-valid
Depends on:
Blocks:
 
Reported: 2009-10-29 08:39 UTC by Don
Modified: 2019-07-16 04:30 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Don 2009-10-29 08:39:03 UTC
Variables of tuple type can be used in assignments, but not anywhere else (including initialization). And the error message is quite terrible.

void foo(T...)(T x) {
   T a;
   T b;
   a = x; // ok
   b = x; // ok
   T c = x; // fails
}

void main() {
   foo(1,2,3);
}
---
test.d(6): Error: cannot implicitly convert expression (tuple(_param_0,_param
1,_param_2)) of type (int, int, int) to int
Comment 1 Don 2009-10-29 08:42:27 UTC
Applies to D1 as well. In 1.020 and earlier, the assignment was rejected. The current behaviour dates from 1.028 or earlier.
Comment 2 yebblies 2012-02-03 23:43:24 UTC
D1 only, works in current D2 (2.058)
Comment 3 Mathias LANG 2019-07-16 04:30:20 UTC
Fixed in D2, closing.