[PATCH][libcxx] add visibility for swap forward declaration
Steven Wu
stevenwu at apple.com
Mon Feb 23 10:08:08 PST 2015
Hi Marshall
This patch added a visibility declaration for the forward declaration you added in r225285.
The forward declared the swap function has no visibility and it might failed to compiler when user tries to change default visibility. For example:
#pragma GCC visibility push(default)
#include <utility>
#pragma GCC visibility pop
In this case, forward declaration and definition will not have the same visibility and the program will failed to compile.
This can be fixed by adding the same visibly to the forward declaration.
diff --git a/include/utility b/include/utility
index 2cb1018..96db60a 100644
--- a/include/utility
+++ b/include/utility
@@ -204,6 +204,7 @@ operator>=(const _Tp& __x, const _Tp& __y)
// forward
template<class _Tp, size_t _Np>
+inline _LIBCPP_INLINE_VISIBILITY
void swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value);
template <class _ForwardIterator1, class _ForwardIterator2>
Thanks
Steven
More information about the cfe-commits
mailing list