[libcxx] r261382 - Make __wrap_iter work with GCC again
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 19 16:19:45 PST 2016
Author: ericwf
Date: Fri Feb 19 18:19:45 2016
New Revision: 261382
URL: http://llvm.org/viewvc/llvm-project?rev=261382&view=rev
Log:
Make __wrap_iter work with GCC again
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"
Reviewers: mclow.lists, EricWF
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D16345
Modified:
libcxx/trunk/include/iosfwd
libcxx/trunk/include/iterator
libcxx/trunk/include/vector
Modified: libcxx/trunk/include/iosfwd
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iosfwd?rev=261382&r1=261381&r2=261382&view=diff
==============================================================================
--- libcxx/trunk/include/iosfwd (original)
+++ libcxx/trunk/include/iosfwd Fri Feb 19 18:19:45 2016
@@ -194,6 +194,11 @@ template <class _CharT, // f
typedef basic_string<char, char_traits<char>, allocator<char> > string;
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
+
+// Include other forward declarations here
+template <class _Tp, class _Alloc = allocator<_Tp> >
+class _LIBCPP_TYPE_VIS_ONLY vector;
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_IOSFWD
Modified: libcxx/trunk/include/iterator
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=261382&r1=261381&r2=261382&view=diff
==============================================================================
--- libcxx/trunk/include/iterator (original)
+++ libcxx/trunk/include/iterator Fri Feb 19 18:19:45 2016
@@ -340,10 +340,10 @@ template <class E> constexpr const E* da
*/
#include <__config>
+#include <iosfwd> // for forward declarations of vector and string.
#include <__functional_base>
#include <type_traits>
#include <cstddef>
-#include <iosfwd>
#include <initializer_list>
#ifdef __APPLE__
#include <Availability.h>
Modified: libcxx/trunk/include/vector
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=261382&r1=261381&r2=261382&view=diff
==============================================================================
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Fri Feb 19 18:19:45 2016
@@ -262,6 +262,7 @@ void swap(vector<T,Allocator>& x, vector
*/
#include <__config>
+#include <iosfwd> // for forward declaration of vector
#include <__bit_reference>
#include <type_traits>
#include <climits>
@@ -453,7 +454,7 @@ __vector_base<_Tp, _Allocator>::~__vecto
}
}
-template <class _Tp, class _Allocator = allocator<_Tp> >
+template <class _Tp, class _Allocator /* = allocator<_Tp> */>
class _LIBCPP_TYPE_VIS_ONLY vector
: private __vector_base<_Tp, _Allocator>
{
More information about the cfe-commits
mailing list