Bug 2675 – cannot foreach structs with copy constructor
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-02-18T17:33:00Z
Last change time
2015-06-09T01:31:17Z
Keywords
ice-on-valid-code
Assigned to
bugzilla
Creator
andrei
Comments
Comment #0 by andrei — 2009-02-18T17:33:43Z
This code fails to comple with the message "Error: e2ir: cannot cast from void to A".
struct A
{
this(this)
{
writeln("B's copy");
}
bool empty() {return false;}
void next() {}
int head() { return 1; }
}
void main()
{
A a;
foreach (e; a) {}
}