On Monday, 22 July 2013 at 16:29:39 UTC, Maxim Fomin wrote:
This also compiles, but I used a different aggregate, yet represents the same thing. Because it is implemented differently, I get a completely different result. Unless I'm mistaken, when a result depends on the implementation, and the implementation doesn't state what the result is, then that's what unspecified behavior is. (unspecified, not undefined).

This is different because in 0..5 ref int maps directly to variable modified, but in iota() it maps to value returned by .front property function and since it doesn't return by ref, refness is wiped out. Behavior is defined in both cases.

defined: yes
entirely dependant on implementation details: also yes

It's not a pattern to be relied on in the slightest.

Reply via email to