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

Recursive QMaps don't compile anymore

    XMLWordPrintable

Details

    • Windows
    • 8780fbb2ebff82f6e9b2dbae9a523d094d327b32 (qt/qtbase/dev)

    Description

      When compiling

      class Foo : public QMap<int, Foo>
      {
      };
      

      with Qt6 beta3 with MSVC 2019 on Windows, this results in compile errors (see below). It works with Qt 5.15, and also worked with the Qt6 beta2.

      Real-life example is in https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/src/plugins/fakevim/fakevimhandler.cpp#n1566

      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qtypeinfo.h(351): error C2968: 'compare_eq_result<int,Foo>': recursive alias declaration
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qmap.h(287): note: see reference to function template instantiation 'enable_if<std::conjunction_v<QTypeTraits::has_operator_equal<T>,QTypeTraits::has_operator_equal<AT>>,bool>::type operator !=(const QMap<int,Foo> &,const QMap<int,Foo> &)' being compiled
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qtypeinfo.h(341): note: see reference to alias template instantiation 'QTypeTraits::detail::expand_operator_equal<Foo>' being compiled
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qtypeinfo.h(351): note: see reference to class template instantiation 'QTypeTraits::has_operator_equal<T>' being compiled
              with
              [
                  T=Foo
              ]
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qtypeinfo.h(351): note: see reference to variable template 'const bool conjunction_v<QTypeTraits::has_operator_equal<int>,QTypeTraits::has_operator_equal<Foo> >' being compiled
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qmap.h(276): note: see reference to alias template instantiation 'QTypeTraits::compare_eq_result<int,Foo>' being compiled
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qmap.h(276): note: see reference to function template instantiation 'enable_if<std::conjunction_v<QTypeTraits::has_operator_equal<T>,QTypeTraits::has_operator_equal<AT>>,bool>::type operator ==(const QMap<int,Foo> &,const QMap<int,Foo> &)' being compiled
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qarraydataops.h(880): note: while compiling class template member function 'void QtPrivate::QMovableArrayOps<T>::insert(QtPrivate::GrowsForwardTag,T *,const T *,const T *)'
              with
              [
                  T=QPoint
              ]
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qarraydataops.h(1374): note: see reference to function template instantiation 'void QtPrivate::QMovableArrayOps<T>::insert(QtPrivate::GrowsForwardTag,T *,const T *,const T *)' being compiled
              with
              [
                  T=QPoint
              ]
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qarraydataops.h(1036): note: see reference to class template instantiation 'QtPrivate::QMovableArrayOps<T>' being compiled
              with
              [
                  T=QPoint
              ]
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qarraydataops.h(1525): note: see reference to class template instantiation 'QtPrivate::QCommonArrayOps<T>' being compiled
              with
              [
                  T=QPoint
              ]
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qlist.h(308): note: see reference to class template instantiation 'QArrayDataOps<T>' being compiled
              with
              [
                  T=QPoint
              ]
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qlist.h(307): note: while compiling class template member function 'QPoint &QList<QPoint>::operator [](qsizetype)'
      C:\Qt\6.0.0\msvc2019_64\include\QtGui/qpolygon.h(114): note: see reference to function template instantiation 'QPoint &QList<QPoint>::operator [](qsizetype)' being compiled
      C:\Qt\6.0.0\msvc2019_64\include\QtGui/qpolygon.h(57): note: see reference to class template instantiation 'QList<QPoint>' being compiled
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qtypeinfo.h(270): error C2976: 'QTypeTraits::detail::expand_operator_equal_container': too few template arguments
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qtypeinfo.h(274): note: see declaration of 'QTypeTraits::detail::expand_operator_equal_container'
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qtypeinfo.h(341): error C3770: 'unknown-type': is not a valid base class
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\type_traits(54): error C2039: 'value': is not a member of 'QTypeTraits::has_operator_equal<T>'
              with
              [
                  T=Foo
              ]
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qtypeinfo.h(351): note: see declaration of 'QTypeTraits::has_operator_equal<T>'
              with
              [
                  T=Foo
              ]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\type_traits(61): note: see reference to class template instantiation 'std::_Conjunction<true,_First,QTypeTraits::has_operator_equal<T>>' being compiled
              with
              [
                  _First=QTypeTraits::has_operator_equal<int>,
                  T=Foo
              ]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\type_traits(66): note: see reference to class template instantiation 'std::conjunction<QTypeTraits::has_operator_equal<Key>,QTypeTraits::has_operator_equal<T>>' being compiled
              with
              [
                  Key=int,
                  T=Foo
              ]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\type_traits(54): error C2065: 'value': undeclared identifier
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\type_traits(54): error C2975: '_First_value': invalid template argument for 'std::_Conjunction', expected compile-time constant expression
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\type_traits(47): note: see declaration of '_First_value'
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\type_traits(66): error C2039: 'value': is not a member of 'std::conjunction<QTypeTraits::has_operator_equal<Key>,QTypeTraits::has_operator_equal<T>>'
              with
              [
                  Key=int,
                  T=Foo
              ]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\type_traits(66): note: see declaration of 'std::conjunction<QTypeTraits::has_operator_equal<Key>,QTypeTraits::has_operator_equal<T>>'
              with
              [
                  Key=int,
                  T=Foo
              ]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\type_traits(66): error C2065: 'value': undeclared identifier
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\type_traits(66): error C2131: expression did not evaluate to a constant
      C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include\type_traits(66): note: a non-constant (sub-)expression was encountered
      

      Attachments

        Issue Links

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

          Activity

            People

              peppe Giuseppe D'Angelo
              con Eike Ziller
              Maurice Kalinowski Maurice Kalinowski
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes