<p dir="ltr">Thanks Richard, I wouldn't have gotten that. One day I'll understand locales.</p>
<div class="gmail_quote">On May 17, 2016 3:22 PM, "Richard Smith" <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Here's an istream_iterator test for this change:</div><div><br></div><div>#include <sstream></div><div>#include <iterator></div><div>#include <cassert></div><div><br></div><div>struct evil_traits : std::char_traits<char> {</div><div>  template<typename T> friend void operator&(T) = delete;</div><div>};</div><div><br></div><div>struct pointless_derived_class</div><div>    : std::num_get<char, std::istreambuf_iterator<char, evil_traits>> {};</div><div><br></div><div>int main() {</div><div>  std::basic_stringstream<char, evil_traits> ss("1 2 3");</div><div>  ss.imbue(std::locale(ss.getloc(), new pointless_derived_class));</div><div><br></div><div>  using II = std::istream_iterator<int, char, evil_traits>;</div><div>  int n = 0;</div><div>  for (auto i = II(ss), e = II(); i != e; ++i)</div><div>    n += *i;</div><div>  assert(n == 6);</div><div>}</div><div><br></div><div>PS: locales suck.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 17, 2016 at 2:09 PM, Eric Fiselier via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">OK, I think I figured it out. I added tests for the ostream_iterator constructors in r269838.<div>I'll follow that up with tests for the istream_iterator constructors, but my current test is failing for reasons beyond me.</div><div><br></div><div>/Eric</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 17, 2016 at 2:36 PM, Eric Fiselier <span dir="ltr"><<a href="mailto:eric@efcs.ca" target="_blank">eric@efcs.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Or maybe I'm still wrong. I tried using a custom traits class to hijack ADL for "operator&" but it doesn't seem to work.<div><br></div><div>Sorry for the spam.</div><span><font color="#888888"><div><br></div><div>/Eric</div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 17, 2016 at 2:25 PM, Eric Fiselier <span dir="ltr"><<a href="mailto:eric@efcs.ca" target="_blank">eric@efcs.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Woops. I was incorrect. It seems that user defined "operator&" overloads can be found in the constructor. From the LWG issue:<div><br></div><div>> Note that {i,o}stream_type are specializations of basic_{i,o}stream, but the constructors might still pick up an overloaded & via the traits template parameter. </div><div><br></div><div>At least that also tells us how to test it.</div><span><font color="#888888"><div><br></div><div>/Eric</div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 17, 2016 at 2:08 PM, Eric Fiselier <span dir="ltr"><<a href="mailto:eric@efcs.ca" target="_blank">eric@efcs.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The difference between "operator&" and "addressof"  is inconsequential when user defined overloads of "operator&" can't be found, which is the case for the changes in the stream iterator constructors. We might as well keep it consistent though. I don't see any value changing it back to use "operator&" in either the library or the standard.<span><font color="#888888"><div><br></div><div>/Eric</div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 17, 2016 at 2:02 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">If some parts are not testable & as you say, not meaningful, then it seems OK to just not implement them & file a DR on the standard, no?</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 17, 2016 at 1:00 PM, Eric Fiselier <span dir="ltr"><<a href="mailto:eric@efcs.ca" target="_blank">eric@efcs.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I added a test for operator->() in r269812. Marshall and I discussed offline about how not all parts of this change are testable (and hence not meaningful) but that's what the standard says to do.<div><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 17, 2016 at 1:51 PM, David Blaikie via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Test coverage?</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 17, 2016 at 10:44 AM, Marshall Clow via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: marshall<br>
Date: Tue May 17 12:44:40 2016<br>
New Revision: 269789<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=269789&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=269789&view=rev</a><br>
Log:<br>
Implement LWG2576: istream_iterator and ostream_iterator should use std::addressof<br>
<br>
Modified:<br>
    libcxx/trunk/include/iterator<br>
    libcxx/trunk/www/cxx1z_status.html<br>
<br>
Modified: libcxx/trunk/include/iterator<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=269789&r1=269788&r2=269789&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=269789&r1=269788&r2=269789&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/iterator (original)<br>
+++ libcxx/trunk/include/iterator Tue May 17 12:44:40 2016<br>
@@ -772,14 +772,14 @@ private:<br>
     _Tp __value_;<br>
 public:<br>
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(0), __value_() {}<br>
-    _LIBCPP_INLINE_VISIBILITY istream_iterator(istream_type& __s) : __in_stream_(&__s)<br>
+    _LIBCPP_INLINE_VISIBILITY istream_iterator(istream_type& __s) : __in_stream_(_VSTD::addressof(__s))<br>
         {<br>
             if (!(*__in_stream_ >> __value_))<br>
                 __in_stream_ = 0;<br>
         }<br>
<br>
     _LIBCPP_INLINE_VISIBILITY const _Tp& operator*() const {return __value_;}<br>
-    _LIBCPP_INLINE_VISIBILITY const _Tp* operator->() const {return &(operator*());}<br>
+    _LIBCPP_INLINE_VISIBILITY const _Tp* operator->() const {return _VSTD::addressof((operator*()));}<br>
     _LIBCPP_INLINE_VISIBILITY istream_iterator& operator++()<br>
         {<br>
             if (!(*__in_stream_ >> __value_))<br>
@@ -811,9 +811,9 @@ private:<br>
     const char_type* __delim_;<br>
 public:<br>
     _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s)<br>
-        : __out_stream_(&__s), __delim_(0) {}<br>
+        : __out_stream_(_VSTD::addressof(__s)), __delim_(0) {}<br>
     _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter)<br>
-        : __out_stream_(&__s), __delim_(__delimiter) {}<br>
+        : __out_stream_(_VSTD::addressof(__s)), __delim_(__delimiter) {}<br>
     _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_)<br>
         {<br>
             *__out_stream_ << __value_;<br>
<br>
Modified: libcxx/trunk/www/cxx1z_status.html<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=269789&r1=269788&r2=269789&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=269789&r1=269788&r2=269789&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/www/cxx1z_status.html (original)<br>
+++ libcxx/trunk/www/cxx1z_status.html Tue May 17 12:44:40 2016<br>
@@ -222,7 +222,7 @@<br>
        <tr><td><a href="<a href="http://cplusplus.github.io/LWG/lwg-defects.html#2572" rel="noreferrer" target="_blank">http://cplusplus.github.io/LWG/lwg-defects.html#2572</a>">2572</a></td><td>The remarks for <tt>shared_ptr::operator*</tt> should apply to <i>cv</i>-qualified <tt>void</tt> as well</td><td>Jacksonville</td><td>Complete</td></tr><br>
        <tr><td><a href="<a href="http://cplusplus.github.io/LWG/lwg-defects.html#2574" rel="noreferrer" target="_blank">http://cplusplus.github.io/LWG/lwg-defects.html#2574</a>">2574</a></td><td>[fund.ts.v2] <tt>std::experimental::function::operator=(F&amp;&amp;)</tt> should be constrained</td><td>Jacksonville</td><td></td></tr><br>
        <tr><td><a href="<a href="http://cplusplus.github.io/LWG/lwg-defects.html#2575" rel="noreferrer" target="_blank">http://cplusplus.github.io/LWG/lwg-defects.html#2575</a>">2575</a></td><td>[fund.ts.v2] <tt>experimental::function::assign</tt> should be removed</td><td>Jacksonville</td><td></td></tr><br>
-       <tr><td><a href="<a href="http://cplusplus.github.io/LWG/lwg-defects.html#2576" rel="noreferrer" target="_blank">http://cplusplus.github.io/LWG/lwg-defects.html#2576</a>">2576</a></td><td><tt>istream_iterator</tt> and <tt>ostream_iterator</tt> should use <tt>std::addressof</tt></td><td>Jacksonville</td><td></td></tr><br>
+       <tr><td><a href="<a href="http://cplusplus.github.io/LWG/lwg-defects.html#2576" rel="noreferrer" target="_blank">http://cplusplus.github.io/LWG/lwg-defects.html#2576</a>">2576</a></td><td><tt>istream_iterator</tt> and <tt>ostream_iterator</tt> should use <tt>std::addressof</tt></td><td>Jacksonville</td><td>Complete</td></tr><br>
        <tr><td><a href="<a href="http://cplusplus.github.io/LWG/lwg-defects.html#2577" rel="noreferrer" target="_blank">http://cplusplus.github.io/LWG/lwg-defects.html#2577</a>">2577</a></td><td><tt>{shared,unique}_lock</tt> should use <tt>std::addressof</tt></td><td>Jacksonville</td><td>Complete</td></tr><br>
        <tr><td><a href="<a href="http://cplusplus.github.io/LWG/lwg-defects.html#2579" rel="noreferrer" target="_blank">http://cplusplus.github.io/LWG/lwg-defects.html#2579</a>">2579</a></td><td>Inconsistency wrt Allocators in <tt>basic_string</tt> assignment vs. <tt>basic_string::assign</tt></td><td>Jacksonville</td><td>Complete</td></tr><br>
        <tr><td><a href="<a href="http://cplusplus.github.io/LWG/lwg-defects.html#2581" rel="noreferrer" target="_blank">http://cplusplus.github.io/LWG/lwg-defects.html#2581</a>">2581</a></td><td>Specialization of <tt>&lt;type_traits&gt;</tt> variable templates should be prohibited</td><td>Jacksonville</td><td>Complete</td></tr><br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>
</blockquote></div>