On 6/6/2017 8:06 PM, Ali Çehreli wrote:
On 06/06/2017 06:09 PM, Steven Schveighoffer wrote:

 > But it is pretty well known that enum'ing an array can have it allocate
 > wherever it is used.

One of the most effective examples is comparing .ptr with (seemingly) itself:

void main() {
     enum e = [ 1 ];
     static assert(e.ptr != e.ptr);
     assert(e.ptr != e.ptr);
}

Both asserts pass. I'm surprised that e.ptr is usable at compile time. Fine, I guess... :)

One trouble with making them the same is if one of the users of e changes an element. Do the rest of the users see the change or the original?

Reply via email to