diff options
Diffstat (limited to 'libcxx/include/tuple')
| -rw-r--r-- | libcxx/include/tuple | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/libcxx/include/tuple b/libcxx/include/tuple index 32bc86913aa..c33b48ab54c 100644 --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -19,7 +19,7 @@ namespace std template <class... T> class tuple { public: - constexpr tuple(); + explicit(see-below) constexpr tuple(); explicit(see-below) tuple(const T&...); // constexpr in C++14 template <class... U> explicit(see-below) tuple(U&&...); // constexpr in C++14 @@ -500,8 +500,19 @@ class _LIBCPP_TEMPLATE_VIS tuple struct _CheckArgsConstructor<true, _Dummy> { template <class ..._Args> - static constexpr bool __enable_default() { - return __all<is_default_constructible<_Args>::value...>::value; + static constexpr bool __enable_implicit_default() { + // In C++03, there's no way to implement the resolution of LWG2510. +#ifdef _LIBCPP_CXX03_LANG + return true; +#else + return __all<__is_implicitly_default_constructible<_Args>::value...>::value; +#endif + } + + template <class ..._Args> + static constexpr bool __enable_explicit_default() { + return __all<is_default_constructible<_Args>::value...>::value + && !__enable_implicit_default<_Args...>(); } template <class ..._Args> @@ -641,11 +652,18 @@ class _LIBCPP_TEMPLATE_VIS tuple const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT; public: - template <bool _Dummy = true, class = typename enable_if< - _CheckArgsConstructor<_Dummy>::template __enable_default<_Tp...>() - >::type> - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR tuple() + template <bool _Dummy = true, _EnableIf< + _CheckArgsConstructor<_Dummy>::template __enable_implicit_default<_Tp...>() + , void*> = nullptr> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + tuple() + _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} + + template <bool _Dummy = true, _EnableIf< + _CheckArgsConstructor<_Dummy>::template __enable_explicit_default<_Tp...>() + , void*> = nullptr> + explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + tuple() _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} tuple(tuple const&) = default; |

