Implement most of P0607: Inline Variables for the Standard Library. This involved marking a lot of variables as inline (but only for C++17 and later).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@321658 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/tuple b/include/tuple
index 5e32b6d..31578d1 100644
--- a/include/tuple
+++ b/include/tuple
@@ -70,7 +70,7 @@
void swap(tuple&) noexcept(AND(swap(declval<T&>(), declval<T&>())...));
};
-const unspecified ignore;
+inline constexpr unspecified ignore;
template <class... T> tuple<V...> make_tuple(T&&...); // constexpr in C++14
template <class... T> tuple<ATypes...> forward_as_tuple(T&&...) noexcept; // constexpr in C++14
@@ -87,7 +87,7 @@
template <class T> class tuple_size; // undefined
template <class... T> class tuple_size<tuple<T...>>;
template <class T>
- constexpr size_t tuple_size_v = tuple_size<T>::value; // C++17
+ inline constexpr size_t tuple_size_v = tuple_size<T>::value; // C++17
template <size_t I, class T> class tuple_element; // undefined
template <size_t I, class... T> class tuple_element<I, tuple<T...>>;
template <size_t I, class T>
@@ -1079,7 +1079,7 @@
};
namespace {
- constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>();
+ _LIBCPP_INLINE_VAR constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>();
}
template <class _Tp>
@@ -1368,7 +1368,7 @@
#if _LIBCPP_STD_VER > 14
template <class _Tp>
-constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
+_LIBCPP_INLINE_VAR constexpr size_t tuple_size_v = tuple_size<_Tp>::value;
#define _LIBCPP_NOEXCEPT_RETURN(...) noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; }