importing std.array: empty in a struct messes things up

visitor visitor at gmail.com
Sun Mar 4 20:07:06 UTC 2018


On Sunday, 4 March 2018 at 19:53:59 UTC, ag0aep6g wrote:
> On 03/04/2018 08:45 PM, ag0aep6g wrote:
>> I don't know what's going on here. The error message doesn't 
>> make sense to me. Might be a bug in the compiler.
>
> This one works:
>
> ----
> struct Stack(T) {
>     T[] stack;
>     alias stack this;
>     bool empty() {return empty(stack);} /* not using UFCS */
>     import std.array: empty; /* has to come after the method */
> }
> ----
>
> Looks very much like a compiler bug now. As far as I know, the 
> order of declarations shouldn't have an effect like that in 
> structs. And UFCS should also be ok there, as far as I can tell.

?????
https://run.dlang.io/is/Ws0qEx
https://run.dlang.io/is/Bancgx


More information about the Digitalmars-d-learn mailing list