diff --git a/libcxx/docs/Status/SpaceshipProjects.csv b/libcxx/docs/Status/SpaceshipProjects.csv --- a/libcxx/docs/Status/SpaceshipProjects.csv +++ b/libcxx/docs/Status/SpaceshipProjects.csv @@ -14,7 +14,7 @@ | `[syserr.errcat.nonvirtuals] `_,| error_category,[comparisons.three.way],Unassigned,|Not Started| | `[syserr.compare] `_,"| error_code | error_condition",None,Unassigned,|Not Started| -| `[tuple.rel] `_,| `tuple `_,[expos.only.func],Kent Ross,|In Progress| +| `[tuple.rel] `_,| `tuple `_,[expos.only.func],Kent Ross,|Complete| "| `[optional.relops] `_ | `[optional.nullops] `_ | `[optional.comp.with.t] `_","| optional diff --git a/libcxx/include/tuple b/libcxx/include/tuple --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -132,11 +132,14 @@ // 20.4.1.6, relational operators: template bool operator==(const tuple&, const tuple&); // constexpr in C++14 -template bool operator<(const tuple&, const tuple&); // constexpr in C++14 -template bool operator!=(const tuple&, const tuple&); // constexpr in C++14 -template bool operator>(const tuple&, const tuple&); // constexpr in C++14 -template bool operator<=(const tuple&, const tuple&); // constexpr in C++14 -template bool operator>=(const tuple&, const tuple&); // constexpr in C++14 +template bool operator<(const tuple&, const tuple&); // constexpr in C++14, removed in C++20 +template bool operator!=(const tuple&, const tuple&); // constexpr in C++14, removed in C++20 +template bool operator>(const tuple&, const tuple&); // constexpr in C++14, removed in C++20 +template bool operator<=(const tuple&, const tuple&); // constexpr in C++14, removed in C++20 +template bool operator>=(const tuple&, const tuple&); // constexpr in C++14, removed in C++20 +template + constexpr common_comparison_category_t...> + operator<=>(const tuple&, const tuple&); // since C++20 template struct uses_allocator, Alloc>; @@ -149,6 +152,8 @@ */ +#include <__compare/common_comparison_category.h> +#include <__compare/synth_three_way.h> #include <__config> #include <__functional/unwrap_ref.h> #include <__functional_base> @@ -156,6 +161,7 @@ #include <__memory/uses_allocator.h> #include <__tuple> #include <__utility/forward.h> +#include <__utility/integer_sequence.h> #include <__utility/move.h> #include #include @@ -1300,6 +1306,30 @@ return __tuple_equal()(__x, __y); } +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS) + +// operator<=> + +template +_LIBCPP_HIDE_FROM_ABI constexpr +auto +__tuple_compare_three_way(const tuple<_Tp...>& __x, const tuple<_Up...>& __y, index_sequence<_Is...>) { + common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...> __result = strong_ordering::equal; + static_cast(((__result = _VSTD::__synth_three_way(_VSTD::get<_Is>(__x), _VSTD::get<_Is>(__y)), __result != 0) || ...)); + return __result; +} + +template +requires (sizeof...(_Tp) == sizeof...(_Up)) +_LIBCPP_HIDE_FROM_ABI constexpr +common_comparison_category_t<__synth_three_way_result<_Tp, _Up>...> +operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) +{ + return __tuple_compare_three_way(__x, __y, index_sequence_for<_Tp...>{}); +} + +#else // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS) + template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool @@ -1368,6 +1398,8 @@ return !(__y < __x); } +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) && !defined(_LIBCPP_HAS_NO_CONCEPTS) + // tuple_cat template struct __tuple_cat_type; diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq_incompatible.compile.fail.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq_incompatible.compile.fail.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq_incompatible.compile.fail.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template class tuple; + +// template +// bool +// operator==(const tuple& t, const tuple& u); + +// UNSUPPORTED: c++03 + +#include + +static_cast(std::tuple(1) == std::tuple(1, 2)); // expected-note {{requested here}} +// expected-error-re@tuple:* {{static_assert failed{{.*}} "Can't compare tuples of different sizes"}} + +static_cast(std::tuple(1, 2) == std::tuple(1)); // expected-note {{requested here}} +// expected-error-re@tuple:* {{static_assert failed{{.*}} "Can't compare tuples of different sizes"}} +// expected-error-re@__tuple:* {{static_assert failed{{.*}} "tuple_element index out of range"}} +// expected-error@tuple:* {{no viable conversion from}} diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/ge_incompatible.compile.fail.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/ge_incompatible.compile.fail.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/ge_incompatible.compile.fail.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template class tuple; + +// template +// bool +// operator>=(const tuple& t, const tuple& u); + +// UNSUPPORTED: c++03 + +#include + +static_cast(std::tuple(1) >= std::tuple(1, 2)); +// c++20 onwards +// expected-error@-2 0-1 {{invalid operands to binary expression}} +static_cast(std::tuple(1, 2) >= std::tuple(1)); +// c++20 onwards +// expected-error@-2 0-1 {{invalid operands to binary expression}} + +// c++11, c++14, c++17 +// expected-error-re@tuple:* 0-2 {{static_assert failed{{.*}} "Can't compare tuples of different sizes"}} +// expected-error-re@__tuple:* 0-1 {{static_assert failed{{.*}} "tuple_element index out of range"}} +// expected-error@tuple:* 0-1 {{no viable conversion from}} + +// c++14, c++17 +// expected-error@tuple:* 0-1 {{no matching function for call to 'get'}} diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/gt_incompatible.compile.fail.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/gt_incompatible.compile.fail.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/gt_incompatible.compile.fail.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template class tuple; + +// template +// bool +// operator>(const tuple& t, const tuple& u); + +// UNSUPPORTED: c++03 + +#include + +static_cast(std::tuple(1) > std::tuple(1, 2)); +// c++20 onwards +// expected-error@-2 0-1 {{invalid operands to binary expression}} +static_cast(std::tuple(1, 2) > std::tuple(1)); +// c++20 onwards +// expected-error@-2 0-1 {{invalid operands to binary expression}} + +// c++11, c++14, c++17 +// expected-error-re@tuple:* 0-2 {{static_assert failed{{.*}} "Can't compare tuples of different sizes"}} +// expected-error-re@__tuple:* 0-1 {{static_assert failed{{.*}} "tuple_element index out of range"}} +// expected-error@tuple:* 0-1 {{no viable conversion from}} + +// c++14, c++17 +// expected-error@tuple:* 0-1 {{no matching function for call to 'get'}} diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/le_incompatible.compile.fail.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/le_incompatible.compile.fail.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/le_incompatible.compile.fail.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template class tuple; + +// template +// bool +// operator<=(const tuple& t, const tuple& u); + +// UNSUPPORTED: c++03 + +#include + +static_cast(std::tuple(1) <= std::tuple(1, 2)); +// c++20 onwards +// expected-error@-2 0-1 {{invalid operands to binary expression}} +static_cast(std::tuple(1, 2) <= std::tuple(1)); +// c++20 onwards +// expected-error@-2 0-1 {{invalid operands to binary expression}} + +// c++11, c++14, c++17 +// expected-error-re@tuple:* 0-2 {{static_assert failed{{.*}} "Can't compare tuples of different sizes"}} +// expected-error-re@__tuple:* 0-1 {{static_assert failed{{.*}} "tuple_element index out of range"}} +// expected-error@tuple:* 0-1 {{no viable conversion from}} + +// c++14, c++17 +// expected-error@tuple:* 0-1 {{no matching function for call to 'get'}} diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt_incompatible.compile.fail.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt_incompatible.compile.fail.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt_incompatible.compile.fail.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template class tuple; + +// template +// bool +// operator<(const tuple& t, const tuple& u); + +// UNSUPPORTED: c++03 + +#include + +static_cast(std::tuple(1) < std::tuple(1, 2)); +// c++20 onwards +// expected-error@-2 0-1 {{invalid operands to binary expression}} +static_cast(std::tuple(1, 2) < std::tuple(1)); +// c++20 onwards +// expected-error@-2 0-1 {{invalid operands to binary expression}} + +// c++11, c++14, c++17 +// expected-error-re@tuple:* 0-2 {{static_assert failed{{.*}} "Can't compare tuples of different sizes"}} +// expected-error-re@__tuple:* 0-1 {{static_assert failed{{.*}} "tuple_element index out of range"}} +// expected-error@tuple:* 0-1 {{no viable conversion from}} + +// c++14, c++17 +// expected-error@tuple:* 0-1 {{no matching function for call to 'get'}} diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/ne_incompatible.compile.fail.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/ne_incompatible.compile.fail.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/ne_incompatible.compile.fail.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template class tuple; + +// template +// bool +// operator!=(const tuple& t, const tuple& u); + +// UNSUPPORTED: c++03 + +#include + +static_cast(std::tuple(1) != std::tuple(1, 2)); // expected-note {{requested here}} +// expected-error-re@tuple:* {{static_assert failed{{.*}} "Can't compare tuples of different sizes"}} + +static_cast(std::tuple(1, 2) != std::tuple(1)); // expected-note {{requested here}} +// expected-error-re@tuple:* {{static_assert failed{{.*}} "Can't compare tuples of different sizes"}} +// expected-error-re@__tuple:* {{static_assert failed{{.*}} "tuple_element index out of range"}} +// expected-error@tuple:* {{no viable conversion from}} diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/three_way.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/three_way.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/three_way.pass.cpp @@ -0,0 +1,203 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template class tuple; + +// template +// auto +// operator<=>(const tuple& t, const tuple& u); + +// UNSUPPORTED: c++03, c++11, c++14, c++17, libcpp-no-concepts +// ADDITIONAL_COMPILE_FLAGS: -Wno-sign-compare + +#include +#include +#include +#include + +#include "test_macros.h" + +// A custom three-way result type +struct CustomEquality { + friend constexpr bool operator==(const CustomEquality&, int) noexcept { return true; } + friend constexpr bool operator<(const CustomEquality&, int) noexcept { return false; } + friend constexpr bool operator<(int, const CustomEquality&) noexcept { return false; } +}; + +constexpr bool test() { + // Empty tuple + { + typedef std::tuple<> T0; + // No member types yields strong ordering (all are equal). + ASSERT_SAME_TYPE(decltype(T0() <=> T0()), std::strong_ordering); + assert((T0() <=> T0()) == std::strong_ordering::equal); + } + // Mixed types with integers, which compare strongly ordered + { + typedef std::tuple T1; + typedef std::tuple T2; + ASSERT_SAME_TYPE(decltype(T1() <=> T2()), std::strong_ordering); + assert((T1(1) <=> T2(1)) == std::strong_ordering::equal); + assert((T1(1) <=> T2(0)) == std::strong_ordering::greater); + assert((T1(1) <=> T2(2)) == std::strong_ordering::less); + } + { + typedef std::tuple T1; + typedef std::tuple T2; + ASSERT_SAME_TYPE(decltype(T1() <=> T2()), std::strong_ordering); + assert((T1(1, 2) <=> T2(1, 2)) == std::strong_ordering::equal); + assert((T1(1, 2) <=> T2(0, 2)) == std::strong_ordering::greater); + assert((T1(1, 2) <=> T2(2, 2)) == std::strong_ordering::less); + assert((T1(1, 2) <=> T2(1, 1)) == std::strong_ordering::greater); + assert((T1(1, 2) <=> T2(1, 3)) == std::strong_ordering::less); + } + { + typedef std::tuple T1; + typedef std::tuple T2; + ASSERT_SAME_TYPE(decltype(T1() <=> T2()), std::strong_ordering); + assert((T1(1, 2, 3) <=> T2(1, 2, 3)) == std::strong_ordering::equal); + assert((T1(1, 2, 3) <=> T2(0, 2, 3)) == std::strong_ordering::greater); + assert((T1(1, 2, 3) <=> T2(2, 2, 3)) == std::strong_ordering::less); + assert((T1(1, 2, 3) <=> T2(1, 1, 3)) == std::strong_ordering::greater); + assert((T1(1, 2, 3) <=> T2(1, 3, 3)) == std::strong_ordering::less); + assert((T1(1, 2, 3) <=> T2(1, 2, 2)) == std::strong_ordering::greater); + assert((T1(1, 2, 3) <=> T2(1, 2, 4)) == std::strong_ordering::less); + } + // Mixed types with floating point, which compare partially ordered + { + typedef std::tuple T1; + typedef std::tuple T2; + ASSERT_SAME_TYPE(decltype(T1() <=> T2()), std::partial_ordering); + assert((T1(1) <=> T2(1)) == std::partial_ordering::equivalent); + assert((T1(1) <=> T2(0.9)) == std::partial_ordering::greater); + assert((T1(1) <=> T2(1.1)) == std::partial_ordering::less); + } + { + typedef std::tuple T1; + typedef std::tuple T2; + ASSERT_SAME_TYPE(decltype(T1() <=> T2()), std::partial_ordering); + assert((T1(1, 2) <=> T2(1, 2)) == std::partial_ordering::equivalent); + assert((T1(1, 2) <=> T2(0.9, 2)) == std::partial_ordering::greater); + assert((T1(1, 2) <=> T2(1.1, 2)) == std::partial_ordering::less); + assert((T1(1, 2) <=> T2(1, 1)) == std::partial_ordering::greater); + assert((T1(1, 2) <=> T2(1, 3)) == std::partial_ordering::less); + } + { + typedef std::tuple T1; + typedef std::tuple T2; + ASSERT_SAME_TYPE(decltype(T1() <=> T2()), std::partial_ordering); + assert((T1(1, 2, 3) <=> T2(1, 2, 3)) == std::partial_ordering::equivalent); + assert((T1(1, 2, 3) <=> T2(0.9, 2, 3)) == std::partial_ordering::greater); + assert((T1(1, 2, 3) <=> T2(1.1, 2, 3)) == std::partial_ordering::less); + assert((T1(1, 2, 3) <=> T2(1, 1, 3)) == std::partial_ordering::greater); + assert((T1(1, 2, 3) <=> T2(1, 3, 3)) == std::partial_ordering::less); + assert((T1(1, 2, 3) <=> T2(1, 2, 2)) == std::partial_ordering::greater); + assert((T1(1, 2, 3) <=> T2(1, 2, 4)) == std::partial_ordering::less); + } + { + typedef std::tuple T1; + typedef std::tuple T2; + // Comparisons with NaN and non-NaN are non-constexpr in GCC, so both sides must be NaN + assert((T1(std::numeric_limits::quiet_NaN()) <=> T2(std::numeric_limits::quiet_NaN())) + == std::partial_ordering::unordered); + } + { + typedef std::tuple T1; + typedef std::tuple T2; + assert((T1(std::numeric_limits::quiet_NaN(), 2) <=> T2(std::numeric_limits::quiet_NaN(), 2)) + == std::partial_ordering::unordered); + assert((T1(1, std::numeric_limits::quiet_NaN()) <=> T2(1, std::numeric_limits::quiet_NaN())) + == std::partial_ordering::unordered); + } + { + typedef std::tuple T1; + typedef std::tuple T2; + assert((T1(std::numeric_limits::quiet_NaN(), 2, 3) <=> T2(std::numeric_limits::quiet_NaN(), 2, 3)) + == std::partial_ordering::unordered); + assert((T1(1, std::numeric_limits::quiet_NaN(), 3) <=> T2(1, std::numeric_limits::quiet_NaN(), 3)) + == std::partial_ordering::unordered); + assert((T1(1, 2, std::numeric_limits::quiet_NaN()) <=> T2(1, 2, std::numeric_limits::quiet_NaN())) + == std::partial_ordering::unordered); + } + // Ordering classes and synthesized three way comparison + { + typedef std::tuple T1; + typedef std::tuple T2; + // All strongly ordered members yields strong ordering. + ASSERT_SAME_TYPE(decltype(T1() <=> T2()), std::strong_ordering); + } + { + struct WeakSpaceship { + constexpr bool operator==(const WeakSpaceship&) const { return true; } + constexpr std::weak_ordering operator<=>(const WeakSpaceship&) const { return std::weak_ordering::equivalent; } + }; + { + typedef std::tuple T1; + typedef std::tuple T2; + // Strongly ordered members and a weakly ordered member yields weak ordering. + ASSERT_SAME_TYPE(decltype(T1() <=> T2()), std::weak_ordering); + } + { + typedef std::tuple T1; + typedef std::tuple T2; + // Doubles are partially ordered, so one partial, one strong, and one weak ordering + // yields partial ordering. + ASSERT_SAME_TYPE(decltype(T1() <=> T2()), std::partial_ordering); + } + } + { + struct NoSpaceship { + constexpr bool operator==(const NoSpaceship&) const { return true; } + constexpr bool operator<(const NoSpaceship&) const { return false; } + }; + typedef std::tuple T1; + typedef std::tuple T2; + // Strongly ordered members and a weakly ordered member (synthesized) yields weak ordering. + ASSERT_SAME_TYPE(decltype(T1() <=> T2()), std::weak_ordering); + } + { + struct SpaceshipNoEquals { + constexpr std::strong_ordering operator<=>(const SpaceshipNoEquals&) const { return std::strong_ordering::equal; } + constexpr bool operator<(const SpaceshipNoEquals&) const { return false; } + }; + typedef std::tuple T1; + typedef std::tuple T2; + // Spaceship operator with no == operator falls back on the < operator and weak ordering. + ASSERT_SAME_TYPE(decltype(T1() <=> T2()), std::weak_ordering); + } + { + struct CustomSpaceship { + constexpr CustomEquality operator<=>(const CustomSpaceship&) const { return CustomEquality(); } + }; + typedef std::tuple T1; + typedef std::tuple T2; + typedef std::tuple T3; + // Custom three way return types cannot be used in synthesized three way comparison, + // but they can be used for (rewritten) operator< when synthesizing a weak ordering. + ASSERT_SAME_TYPE(decltype(T1() <=> T2()), std::weak_ordering); + ASSERT_SAME_TYPE(decltype(T3() <=> T3()), std::weak_ordering); + } + { + typedef std::tuple T1; + typedef std::tuple T2; + // Even with the warning suppressed (-Wno-sign-compare) there should still be no <=> operator + // between signed and unsigned types, so we should end up with a synthesized weak ordering. + ASSERT_SAME_TYPE(decltype(T1() <=> T2()), std::weak_ordering); + } + + return true; +} + +int main(int, char**) { + static_assert(test()); + assert(test()); + + return 0; +} diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/three_way_incompatible.compile.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/three_way_incompatible.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.rel/three_way_incompatible.compile.pass.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template class tuple; + +// template +// auto +// operator<=>(const tuple& t, const tuple& u); + +// UNSUPPORTED: c++03, c++11, c++14, c++17, libcpp-no-concepts + +#include + +template +concept can_compare = requires(T t, U u) { t <=> u; }; + +typedef std::tuple T1; +typedef std::tuple T2; + +static_assert(!can_compare, ""); +static_assert(!can_compare, "");