[Issue 7945] New: alias this doesn't work on function ref parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Apr 19 06:35:27 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7945
Summary: alias this doesn't work on function ref parameter
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2012-04-19 06:36:22 PDT ---
The four calls should work, but #1 doesn't work.
struct S
{
int v;
alias v this;
}
void foo(ref int n){}
void main()
{
auto s = S(1);
// variable s is lvalue, so
// alias this expanded expression s.v is also lvalue and matches to ref.
foo(s); // 1.NG -> OK
s.foo(); // 2.OK, ufcs
foo(s.v); // 3.OK
s.v.foo(); // 4.OK, ufcs
}
--
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