D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7943 - UFCS does not work with alias this
Summary: UFCS does not work with alias this
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2012-04-19 04:47 UTC by jens.k.mueller
Modified: 2012-04-19 14:44 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description jens.k.mueller 2012-04-19 04:47:04 UTC
The following code does not compile but it should.

ufcs.d:
struct Foo
{
   int _member;
   alias _member this;
}

int foo(Foo f) { return f._member; }

unittest
{
   Foo f;
   f.foo(); // fails to compile
}

Using dmd2.059 you get:
Error: function ufcs.foo (Foo f) is not callable using argument types (int)
Error: cannot implicitly convert expression (f._member) of type int to Foo

Note, that this bugs prevents using UFCS with std.typecons.Tuple.

http://forum.dlang.org/thread/mailman.1925.1334827762.4860.digitalmars-d@puremagic.com
Comment 2 github-bugzilla 2012-04-19 14:14:39 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/4540f0b9e1bbd1b251d5e49428a6a5c0cd1f9c65
fix Issue 7943 - UFCS does not work with alias this

https://github.com/D-Programming-Language/dmd/commit/11f70c7b5cea33e9a93601b2a2fdabb260d47276
Merge pull request #890 from 9rnsr/fix7943

Issue 7943 - UFCS does not work with alias this