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

QMap<QVariant, QVariant> compilation error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 6.0.0 Alpha
    • None
    • Qt 6.0.0-202010060504 from installer (MSVC 2019 64-bit)
      MSVC 2019 - Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29112 for x64
      Windows 10 x64 2004
    • Windows

    Description

      Simple example:

      #include <QCoreApplication>
      #include <QMap>
      #include <QVariant>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
      
          QMap<QVariant, QVariant> map;
          map.insert(QVariant("test"), QVariant("test"));
          qDebug() << map.first();
      
          return a.exec();
      }
      

      Leads to compilation error on Qt 6 alpha:

      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\xstddef(127): error C2678: binary '<': no operator found which takes a left-hand operand of type 'const _Ty' (or there is no acceptable conversion)
              with
              [
                  _Ty=QVariant
              ]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\variant(1697): note: could be 'bool std::operator <(std::monostate,std::monostate) noexcept'
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qchar.h(67): note: or       'bool operator <(char,QLatin1Char) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qchar.h(74): note: or       'bool operator <(QLatin1Char,char) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qchar.h(612): note: or       'bool operator <(QChar,QChar) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qchar.h(621): note: or       'bool operator <(QChar,std::nullptr_t) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qchar.h(623): note: or       'bool operator <(std::nullptr_t,QChar) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qbytearrayview.h(307): note: or       'bool operator <(QByteArrayView,QByteArrayView) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qbytearray.h(589): note: or       'bool operator <(const QByteArray &,const QByteArray &) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qbytearray.h(591): note: or       'bool operator <(const QByteArray &,const char *) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qbytearray.h(593): note: or       'bool operator <(const char *,const QByteArray &) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qanystringview.h(290): note: or       'bool operator <(QAnyStringView,QAnyStringView) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qstring.h(783): note: or       'bool operator <(const QString &,const QString &) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qstring.h(1259): note: or       'bool operator <(const char *,const QString &)' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qstring.h(1407): note: or       'bool operator <(QChar,const QString &) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qstring.h(1426): note: or       'bool operator <(QChar,QLatin1String) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qstring.h(1215): note: or       'bool operator <(QLatin1String,QLatin1String) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qstring.h(1272): note: or       'bool operator <(const char *,QLatin1String)' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qstring.h(1418): note: or       'bool operator <(const QString &,QChar) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qstring.h(1437): note: or       'bool operator <(QLatin1String,QChar) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qstring.h(1455): note: or       'bool operator <(QStringView,QChar) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qstring.h(1462): note: or       'bool operator <(QChar,QStringView) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qstring.h(1470): note: or       'bool operator <(QStringView,QLatin1String) noexcept' [found using argument-dependent lookup]
      ..\..\..\qt\official\6.0.0\msvc2019_64\include\QtCore/qstring.h(1477): note: or       'bool operator <(QLatin1String,QStringView) noexcept' [found using argument-dependent lookup]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\xstddef(127): note: while trying to match the argument list '(const _Ty, const _Ty)'
              with
              [
                  _Ty=QVariant
              ]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\xstddef(126): note: while compiling class template member function 'bool std::less<Key>::operator ()(const _Ty &,const _Ty &) const'
              with
              [
                  Key=QVariant,
                  _Ty=QVariant
              ]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\xtree(1705): note: see reference to function template instantiation 'bool std::less<Key>::operator ()(const _Ty &,const _Ty &) const' being compiled
              with
              [
                  Key=QVariant,
                  _Ty=QVariant
              ]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\xmemory(1326): note: see reference to class template instantiation 'std::less<Key>' being compiled
              with
              [
                  Key=QVariant
              ]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\xmemory(1326): note: see reference to variable template 'const bool is_empty_v<std::less<QVariant> >' being compiled
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\map(75): note: see reference to class template instantiation 'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>' being compiled
              with
              [
                  _Kty=QVariant,
                  _Ty=QVariant,
                  _Pr=std::less<QVariant>,
                  _Alloc=std::allocator<std::pair<const QVariant,QVariant>>
              ]
      F:\qt\official\6.0.0\msvc2019_64\include\QtCore\qmap.h(64): note: see reference to class template instantiation 'std::map<Key,T,std::less<Key>,std::allocator<std::pair<const Key,T>>>' being compiled
              with
              [
                  Key=QVariant,
                  T=QVariant
              ]
      F:\qt\official\6.0.0\msvc2019_64\include\QtCore\qmap.h(439): note: see reference to class template instantiation 'QMapData<std::map<Key,T,std::less<Key>,std::allocator<std::pair<const Key,T>>>>' being compiled
              with
              [
                  Key=QVariant,
                  T=QVariant
              ]
      ..\maptest\main.cpp(11): note: see reference to class template instantiation 'QMap<QVariant,QVariant>::iterator' being compiled
      

      Works on 5.15.1.

      Attachments

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

        Activity

          People

            laknoll Lars Knoll
            vladimmi Vladimir Marchevsky
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes