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

ag0aep6g anonymous at example.com
Sun Mar 4 19:53:59 UTC 2018


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.


More information about the Digitalmars-d-learn mailing list