<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 11, 2014, at 2:14 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><blockquote class="gmail_quote" style="font-family: LucidaGrande; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;"><div>I’m open to suggestions here:</div><div>a) I can put the instance variable back, and never use it. No ABI break, but an unused iterator in every reverse iterator.</div></div></blockquote><div style="font-family: LucidaGrande; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: LucidaGrande; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Any code that passes a reverse_iterator between TUs built against different libc++ versions would still not work.</div></blockquote><br></div><div>Ok, I missed this comment; I thought it applied to the change - not the proposed fix.</div><div>I disagree. I do not believe that putting the instance variable back and not using it will not break code across TUs.</div><div><br></div><div>The only use of the instance variable __t is in the operator*() for the reverse iterator, which used to say:</div><div><span style="font-family: LucidaGrande;"><span class="Apple-tab-span" style="white-space:pre">  </span>_LIBCPP_INLINE_VISIBILITY reference operator*() const {__t = current; return *--__t;}</span></div><div>(i.e, the variable is set immediately before use)</div><div>but now says:<br style="font-family: LucidaGrande;"><span style="font-family: LucidaGrande;"><span class="Apple-tab-span" style="white-space:pre">      </span>_LIBCPP_INLINE_VISIBILITY reference operator*() const {_Iter __tmp = current; return *--__tmp;}</span><br style="font-family: LucidaGrande;"></div><div><br></div><div>The purpose of having this instance variable “stick around”, rather than being a local variable, was to support iterators whose operator* returned a reference to something inside of the iterator. If the iterator was a local variable, then the things contained inside of it would be destroyed when the iterator was destroyed.</div><div><br></div><div>However, in #2360, <a href="mailto:STL@microsoft.com">STL@microsoft.com</a> pointed out that this was inviting silent data races, and the LWG decided not to support those kind of iterators any more.</div><div>(see the comments on LWG issue #198, which #2360 partially reversed).</div><div><br></div><div>Richard — clearly you think otherwise.</div><div>I’d like to hear your explanation as to why.</div><div><br></div><div>— Marshall</div><div><br></div></body></html>