[Issue 2702] New: Declaring struct, assigning rvalue via opAssign in same statement fails silently
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 1 17:37:48 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2702
Summary: Declaring struct, assigning rvalue via opAssign in same
statement fails silently
Product: D
Version: 2.025
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: wrong-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: dsimcha at yahoo.com
import std.stdio;
struct Bar {
uint num;
Bar opAssign(uint otherNum) {
num = otherNum;
return this;
}
}
void main() {
Bar bar = 1;
writeln(bar.num); // Prints 0.
}
--
More information about the Digitalmars-d-bugs
mailing list