QMetaType: fix recursive detection of std::optional operators
Commitbb10ca54b741d6used the internal has_operator_equal (and commit01d94760d8copied that for has_operator_less_than) instead of using the recursive expander that was being used here. That assumed that the contained type in std::optional would always be the last final check, which is an incorrect assumption. Fixes: QTBUG-115646 Pick-to: 6.6 6.5 Change-Id: Ifbf974a4d10745b099b1fffd177702934bec27ff Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
parent
c6fce818db
commit
cff13c2417
|
|
@ -237,7 +237,7 @@ using expand_operator_equal_recursive = std::conjunction<expand_operator_equal<T
|
|||
template<typename T>
|
||||
struct expand_operator_equal_tuple : has_operator_equal<T> {};
|
||||
template<typename T>
|
||||
struct expand_operator_equal_tuple<std::optional<T>> : has_operator_equal<T> {};
|
||||
struct expand_operator_equal_tuple<std::optional<T>> : expand_operator_equal_recursive<T> {};
|
||||
template<typename T1, typename T2>
|
||||
struct expand_operator_equal_tuple<std::pair<T1, T2>> : expand_operator_equal_recursive<T1, T2> {};
|
||||
template<typename ...T>
|
||||
|
|
@ -277,7 +277,7 @@ using expand_operator_less_than_recursive = std::conjunction<expand_operator_les
|
|||
template<typename T>
|
||||
struct expand_operator_less_than_tuple : has_operator_less_than<T> {};
|
||||
template<typename T>
|
||||
struct expand_operator_less_than_tuple<std::optional<T>> : has_operator_less_than<T> {};
|
||||
struct expand_operator_less_than_tuple<std::optional<T>> : expand_operator_less_than_recursive<T> {};
|
||||
template<typename T1, typename T2>
|
||||
struct expand_operator_less_than_tuple<std::pair<T1, T2>> : expand_operator_less_than_recursive<T1, T2> {};
|
||||
template<typename ...T>
|
||||
|
|
|
|||
|
|
@ -123,6 +123,26 @@ static_assert(!QTypeTraits::has_operator_less_than_v<std::tuple<int, Nested2>>);
|
|||
static_assert(QTypeTraits::has_operator_equal_v<std::tuple<int, Nested2>>);
|
||||
static_assert(!QTypeTraits::has_operator_less_than_v<std::tuple<int, Nested2>>);
|
||||
|
||||
// optionals of nesteds
|
||||
static_assert(QTypeTraits::has_operator_equal_v<std::optional<std::variant<QString>>>);
|
||||
static_assert(QTypeTraits::has_operator_less_than_v<std::optional<std::variant<QString>>>);
|
||||
static_assert(!QTypeTraits::has_operator_equal_v<std::optional<std::variant<NoOperators>>>);
|
||||
static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<std::variant<NoOperators>>>);
|
||||
|
||||
static_assert(QTypeTraits::has_operator_equal_v<std::optional<Nested>>);
|
||||
static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<Nested>>);
|
||||
static_assert(QTypeTraits::has_operator_equal_v<std::optional<std::tuple<int, Nested>>>);
|
||||
static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<std::tuple<int, Nested>>>);
|
||||
static_assert(QTypeTraits::has_operator_equal_v<std::optional<std::tuple<int, Nested>>>);
|
||||
static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<std::tuple<int, Nested>>>);
|
||||
|
||||
static_assert(QTypeTraits::has_operator_equal_v<std::optional<Nested2>>);
|
||||
static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<Nested2>>);
|
||||
static_assert(QTypeTraits::has_operator_equal_v<std::optional<std::tuple<int, Nested2>>>);
|
||||
static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<std::tuple<int, Nested2>>>);
|
||||
static_assert(QTypeTraits::has_operator_equal_v<std::optional<std::tuple<int, Nested2>>>);
|
||||
static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<std::tuple<int, Nested2>>>);
|
||||
|
||||
}
|
||||
|
||||
struct BaseGenericType
|
||||
|
|
|
|||
Loading…
Reference in New Issue