<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 27, 2015 at 3:24 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.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"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Tue, Jan 27, 2015 at 3:19 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Tue, Jan 27, 2015 at 11:27 AM, Nico Weber <span dir="ltr"><<a href="mailto:nicolasweber@gmx.de" target="_blank">nicolasweber@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: nico<br>
Date: Tue Jan 27 13:27:39 2015<br>
New Revision: 227226<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=227226&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=227226&view=rev</a><br>
Log:<br>
[libcxx] Make __wrap_iter work with gcc.<br>
<br>
he following snippet doesn't build when using gcc and libc++:<br>
<br>
    #include <string><br>
    void f(const std::string& s) { s.begin(); }<br>
    #include <vector><br>
    void AppendTo(const std::vector<char>& v) { v.begin(); }<br>
<br>
The problem is that __wrap_iter has a private constructor. It lists vector<><br>
and basic_string<> as friends, but gcc seems to ignore this for vector<> for<br>
some reason. Declaring vector before the friend declaration in __wrap_iter is<br>
enough to work around this problem, so do that. With this patch, I'm able to<br>
build chromium/android with libc++. Without it, two translation units fail to<br>
build. (iosfwd already provides a forward declaration of basic_string.)<br>
<br>
As far as I can tell, this is due to a gcc bug, which I filed as<br>
<a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64816" target="_blank">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64816</a>.<br>
<br>
Fixes PR22355.<br>
<br>
<a href="http://reviews.llvm.org/D7201" target="_blank">http://reviews.llvm.org/D7201</a><br>
<br>
Added:<br>
    libcxx/trunk/test/std/iterators/iterators.general/gcc_workaround.pass.cpp<br>
Modified:<br>
    libcxx/trunk/include/iterator<br>
<br>
Modified: libcxx/trunk/include/iterator<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=227226&r1=227225&r2=227226&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=227226&r1=227225&r2=227226&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/iterator (original)<br>
+++ libcxx/trunk/include/iterator Tue Jan 27 13:27:39 2015<br>
@@ -1112,6 +1112,8 @@ typename enable_if<br>
 >::type<br>
 __unwrap_iter(__wrap_iter<_Tp*>);<br>
<br>
+template <class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS_ONLY vector;<br></blockquote></div></div><div><br>Worth including a comment that this is a workaround for a particular bug</div></div></div></div></blockquote><div><br></div></div></div><div>I went with the prevalent documentation style in libc++ :-)</div></div></div></div></blockquote><div><br></div><div>;) revision history will hopefully suffice.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><div> </div><blockquote class="gmail_quote" style="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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> (is there a GCC bug filed for this?)?<br></div></div></div></div></blockquote><div><br></div></span><div>Yes, see this snippet in the CL description:</div><span class=""><div><br></div><div>"""</div><div>As far as I can tell, this is due to a gcc bug, which I filed as</div><div><a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64816" target="_blank">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64816</a>.</div><div>"""</div><div><br></div></span><div>There's some more rambling on the topic (a link to a clang bug I found while working on this, etc) in the mentioned PR22355 too.</div></div></div></div></blockquote><div><br>Ah, right - sorry I missed that.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+<br>
 template <class _Iter><br>
 class __wrap_iter<br>
 {<br>
<br>
Added: libcxx/trunk/test/std/iterators/iterators.general/gcc_workaround.pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterators.general/gcc_workaround.pass.cpp?rev=227226&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterators.general/gcc_workaround.pass.cpp?rev=227226&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/iterators/iterators.general/gcc_workaround.pass.cpp (added)<br>
+++ libcxx/trunk/test/std/iterators/iterators.general/gcc_workaround.pass.cpp Tue Jan 27 13:27:39 2015<br>
@@ -0,0 +1,20 @@<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is dual licensed under the MIT and the University of Illinois Open<br>
+// Source Licenses. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+// Tests workaround for  <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64816" target="_blank">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64816</a>.<br>
+<br>
+#include <string><br>
+<br>
+void f(const std::string &s) { s.begin(); }<br>
+<br>
+#include <vector><br>
+<br>
+void AppendTo(const std::vector<char> &v) { v.begin(); }<br>
+<br>
+int main() {}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div></div><br></div></div>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div>