On Tuesday, August 20, 2013 11:38:34 monarch_dodra wrote: > I think one exception to this is when you index an enum. EG: > enum vals=[1, 2, 3, 0]; > > auto a = vals[i]; > > Here, the compiler will not make an allocation (at least, it > didn't last time I tested)
It probably does an optimtization based on constant folding or somesuch. And I'm sure that there are other cases where the compiler could theoretically optimize some array allocations, but in general, I wouldn't bet on dmd being that smart at this point. - Jonathan M Davis
