[Issue 7266] New: [CTFE] Can't alter ref param taken from struct member
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 10 19:47:53 PST 2012
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 at puremagic.com
ReportedBy: cbkbbejeap at mailinator.com
--- Comment #0 from Nick Sabalausky <cbkbbejeap at 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: -------
More information about the Digitalmars-d-bugs
mailing list