This is an archive of the discontinued LLVM Phabricator instance.

Make __wrap_iter work with GCC again
ClosedPublic

Authored by EricWF on Jan 19 2016, 9:37 PM.

Details

Summary

This bug was originally fixed in http://reviews.llvm.org/D7201.

However it was broken again by the fix to https://llvm.org/bugs/show_bug.cgi?id=22605.

This patch re-fixes wrap_iter with GCC by providing a forward declaration of <vector> before the friend declaration in wrap_iter.
This patch avoids the issues in PR22605 by putting canonical forward declarations in <iosfwd> and including <iosfwd> in <vector>.

<iosfwd> was chosen as the canonical forward declaration headers for the following reasons:

  1. <iosfwd> is small with almost no dependancies.
  2. It already forward declares std::allocator
  3. It is already included in <iterator> which we need to fix the GCC bug.

This patch fixes the test "gcc_workaround.pass.cpp"

Diff Detail

Event Timeline

EricWF updated this revision to Diff 45348.Jan 19 2016, 9:37 PM
EricWF retitled this revision from to Make __wrap_iter work with GCC again.
EricWF updated this object.
EricWF added a reviewer: mclow.lists.
EricWF added a subscriber: cfe-commits.
EricWF accepted this revision.Feb 19 2016, 4:23 PM
EricWF added a reviewer: EricWF.

@mclow.lists said this was OK to commit if he couldn't think of a better idea. It's unfortunate to use <iosfwd> to forward declare containers but <vector> already included <iosfwd> indirectly so theres no extra cost to putting the forward declaration there.

This revision is now accepted and ready to land.Feb 19 2016, 4:23 PM
EricWF closed this revision.Feb 19 2016, 4:24 PM