Bug 3451 – (D1 only) Initializers don't work for tuple variables
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2009-10-29T08:39:03Z
Last change time
2019-07-16T04:30:20Z
Keywords
diagnostic, rejects-valid
Assigned to
No Owner
Creator
Don
Comments
Comment #0 by clugdbug — 2009-10-29T08:39:03Z
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 by clugdbug — 2009-10-29T08:42:27Z
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 by yebblies — 2012-02-03T23:43:24Z
D1 only, works in current D2 (2.058)
Comment #3 by pro.mathias.lang — 2019-07-16T04:30:20Z