January 11, 2012 [Issue 7266] New: [CTFE] Can't alter ref param taken from struct member | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7266 Summary: [CTFE] Can't alter ref param taken from struct member Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: cbkbbejeap@mailinator.com --- Comment #0 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2012-01-10 19:47:50 PST --- ----------------------------------- import std.stdio; struct S { int a; } int foo() { S s; return bar(s.a); // A //bar(s.a); return s.a; // B } int bar(ref int b) { b = 5; return b; } enum y = foo(); void main() { writeln(y); } ----------------------------------- Expected output: 5 Actual output: 0 Same thing occurs with either the "// A" line or the "// B" line uncommented. Also occurs with "out" instead of "ref". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 15, 2012 [Issue 7266] [CTFE] Assign to ref param (that's taken from struct member) is noop | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | http://d.puremagic.com/issues/show_bug.cgi?id=7266 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2012-01-14 17:41:04 PST --- https://github.com/D-Programming-Language/dmd/commit/1cbd1959e41d39c812a8f4c1a17eb8535d44547a https://github.com/D-Programming-Language/dmd/commit/1394b3c55c740106555cd484697019e4a9b77109 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation