Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-115646

QTypeTraits::has_operator_less_than_v behaves surprisingly

XMLWordPrintable

    • cff13c241 (dev), 599525ef5 (6.5), 687415e10 (6.6)

      Consider the following code that compiles successfully:

      #include <optional>
      #include <variant>
      
      #include <QTypeInfo>
      
      struct S {};
      static_assert(!QTypeTraits::has_operator_less_than_v<S>);
      
      using T = std::variant<S>;
      static_assert(!QTypeTraits::has_operator_less_than_v<T>);
      
      using U = std::optional<S>;
      static_assert(!QTypeTraits::has_operator_less_than_v<U>);
      
      // However
      using V = std::optional<T>;
      static_assert(QTypeTraits::has_operator_less_than_v<V>);
      

      It seems to me that the last `static_assert` ought to fail and that the current behavior is a bug. This shows up if one tries to register `V` as a meta type.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            hannesscheer Johannes Scheer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes