UFCS overrides alias this
anonymous via Digitalmars-d
digitalmars-d at puremagic.com
Sun Apr 12 13:52:33 PDT 2015
On Sunday, 12 April 2015 at 20:48:57 UTC, Freddy wrote:
> ----test.d
> static import std.range;
> alias empty=std.range.empty;
> struct A{
> string b;
> alias b this;
> }
>
> struct MyRange{
>
> }
> char front(MyRange);
> void popFront(ref MyRange);
> bool empty(MyRange);
>
> void test(A a){
> a.empty;
> }
> ----
> $ dmd -o- test
> test.d(16): Error: overload alias 'empty' is not a variable
> ----
> No idea what dmd is doing.
Looks like order matters.
This works:
bool empty(MyRange);
alias empty = std.range.empty;
This doesn't:
alias empty = std.range.empty;
bool empty(MyRange);
I don't know if there's a reason for that or if dmd is just being
silly.
More information about the Digitalmars-d
mailing list