Bug 3614 – empty tuples not assignable: Error: tuple has no effect in expression (tuple())
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
Other
OS
All
Creation time
2009-12-13T17:29:20Z
Last change time
2019-10-24T12:08:53Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
nfxjfg
Comments
Comment #0 by nfxjfg — 2009-12-13T17:29:20Z
First off, this report is for 1.053, but I could select only up to 1.051.
Apparently empty tuples can't be assigned, thus creating special cases whenever a tuple happens to have 0 elements.
The following code fails to compile and I think it shouldn't:
void foo(T...)(T a) {
struct X {
T a;
}
X x;
x.a = a; //line 6
}
void test() {
foo!(int)(0); //works
foo!()(); //fails
}
void main() {}
Compilation fails with:
a.d(6): Error: tuple has no effect in expression (tuple())
a.d(11): Error: template instance a.foo!() error instantiating
Not sure how this is related to bug 3278 or bug 3600.
Comment #1 by razvan.nitu1305 — 2019-10-24T12:08:53Z
This has been fixed in D2 and D1 is no longer supported. Closing as fixed.