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

QtConcurrent failure with noexcept pmf

    XMLWordPrintable

Details

    • c5e687895dd2eba3106f697b6e92b84683402403

    Description

      calling QtConcurrent::mappedReduced with a noexcept pointer to static member function as map parameter fails with the following error

      /home/eric/Qt/5.7/gcc_64/include/QtCore/qvector.h:73:31: error: cannot form a reference to 'void' [clang-diagnostic-error]
          QVector(int size, const T &t);
                                    ^
      /home/eric/Qt/5.7/gcc_64/include/QtConcurrent/qtconcurrentreducekernel.h:82:16: note: in instantiation of template class 'QVector<void>' requested here
          QVector<T> vector;
                     ^
      /home/eric/Qt/5.7/gcc_64/include/QtCore/qmap.h:117:7: note: in instantiation of template class 'QtConcurrent::IntermediateResults<void>' requested here
          T value;
            ^
      /home/eric/Qt/5.7/gcc_64/include/QtCore/qmap.h:250:19: note: in instantiation of template class 'QMapNode<int, QtConcurrent::IntermediateResults<void> >' requested here
                  root()->destroySubTree();
                        ^
      /home/eric/Qt/5.7/gcc_64/include/QtCore/qmap.h:341:46: note: in instantiation of member function 'QMapData<int, QtConcurrent::IntermediateResults<void> >::destroy' requested here
          inline ~QMap() { if (!d->ref.deref()) d->destroy(); }
                                                   ^
      /home/eric/Qt/5.7/gcc_64/include/QtConcurrent/qtconcurrentreducekernel.h:100:7: note: in instantiation of member function 'QMap<int, QtConcurrent::IntermediateResults<void> >::~QMap' requested here
      class ReduceKernel
            ^
      /home/eric/Qt/5.7/gcc_64/include/QtConcurrent/qtconcurrentmapkernel.h:247:34: note: in instantiation of member function 'QtConcurrent::SequenceHolder2<QSet<Interface_Type>, QtConcurrent::MappedReducedKernel<int, QSet<Interface_Type>::const_iterator, QVector<Interface_Data> (*)(Interface_Type) noexcept, (lambda at /home/eric/jenkins/workspace/PhysioFlow/software/staticAnalysis/Clang-Tidy/Core/Master/Device_Manager/device_manager.cpp:305:102), QtConcurrent::ReduceKernel<(lambda at /home/eric/jenkins/workspace/PhysioFlow/software/staticAnalysis/Clang-Tidy/Core/Master/Device_Manager/device_manager.cpp:305:102), int, void> >, QVector<Interface_Data> (*)(Interface_Type) noexcept, (lambda at /home/eric/jenkins/workspace/PhysioFlow/software/staticAnalysis/Clang-Tidy/Core/Master/Device_Manager/device_manager.cpp:305:102)>::SequenceHolder2' requested here
          return startThreadEngine(new SequenceHolderType(sequence, mapFunctor, reduceFunctor, options));
                                       ^
      /home/eric/Qt/5.7/gcc_64/include/QtConcurrent/qtconcurrentmap.h:126:12: note: in instantiation of function template specialization 'QtConcurrent::startMappedReduced<void, int, QSet<Interface_Type>, QVector<Interface_Data> (*)(Interface_Type) noexcept, (lambda at /home/eric/jenkins/workspace/PhysioFlow/software/staticAnalysis/Clang-Tidy/Core/Master/Device_Manager/device_manager.cpp:305:102)>' requested here
          return startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType, ResultType>
                 ^
      /home/eric/jenkins/workspace/PhysioFlow/software/staticAnalysis/Clang-Tidy/Core/Master/Device_Manager/device_manager.cpp:305:49: note: in instantiation of function template specialization 'QtConcurrent::mappedReduced<int, QSet<Interface_Type>, QVector<Interface_Data> (*)(Interface_Type) noexcept, (lambda at /home/eric/jenkins/workspace/PhysioFlow/software/staticAnalysis/Clang-Tidy/Core/Master/Device_Manager/device_manager.cpp:305:102)>' requested here
          const auto interfacesFuture = QtConcurrent::mappedReduced<int>(interfaceTypes, &Interface::scan, [this](auto &res, const auto &interfaces) noexcept
      

      noexcept lambdas do not have this problem.
      It is linked to http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html There was same same problem on QObject::connect : https://bugreports.qt.io/browse/QTBUG-58054 which is solved by https://codereview.qt-project.org/181868
      qtconcurrentfunctionwrappers.h probably misses noexcept specialization

      Attachments

        Issue Links

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

          Activity

            People

              sorvig Morten Sørvig
              ericlemanissier Eric Lemanissier
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes