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

Impossible to connect signal to noexcept pmf

    XMLWordPrintable

Details

    • 5a1b4832a2704e7fb386d6b4c73dab85facdc40b

    Description

      when trying to connect a signal to a noexcept pmf, the following static_assert triggers:

      /home/eric/Qt/5.7/gcc_64/include/QtCore/qobject.h:306:9: error: static_assert failed "Signal and slot arguments are not compatible." [clang-diagnostic-error]
              Q_STATIC_ASSERT_X((FunctorArgumentCount >= 0),
              ^
      /home/eric/Qt/5.7/gcc_64/include/QtCore/qglobal.h:746:47: note: expanded from macro 'Q_STATIC_ASSERT_X'
      #define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
                                                    ^
      /home/eric/jenkins/workspace/PhysioFlow/software/staticAnalysis/Clang-Tidy/Core/../Common/rpcsocket.cpp:13:5: note: in instantiation of function template specialization 'QObject::connect<void (QIODevice::*)(), void (RPCSocket::*)() noexcept>' requested here
          connect(socket, &QIODevice::readyRead, this, &RPCSocket::clientData);
          ^
      /home/eric/Qt/5.7/gcc_64/include/QtCore/qobjectdefs_impl.h:501:13: error: called object type 'void (RPCSocket::*)() noexcept' is not a function or function pointer [clang-diagnostic-error]
                  f((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type *>(arg[II+1]))...), ApplyReturnValue<R>(arg[0]);
                  ^
      /home/eric/Qt/5.7/gcc_64/include/QtCore/qobjectdefs_impl.h:558:79: note: in instantiation of member function 'QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (RPCSocket::*)() noexcept>::call' requested here
                  FunctorCall<typename Indexes<N>::Value, SignalArgs, R, Function>::call(f, arg);
                                                                                    ^
      /home/eric/Qt/5.7/gcc_64/include/QtCore/qobject_impl.h:198:36: note: in instantiation of function template specialization 'QtPrivate::Functor<void (RPCSocket::*)() noexcept, 0>::call<QtPrivate::List<>, void>' requested here
                      FuncType::template call<Args, R>(static_cast<QFunctorSlotObject*>(this_)->function, r, a);
                                         ^
      /home/eric/Qt/5.7/gcc_64/include/QtCore/qobject_impl.h:207:71: note: in instantiation of member function 'QtPrivate::QFunctorSlotObject<void (RPCSocket::*)() noexcept, 0, QtPrivate::List<>, void>::impl' requested here
              explicit QFunctorSlotObject(const Func &f) : QSlotObjectBase(&impl), function(f) {}
                                                                            ^
      /home/eric/Qt/5.7/gcc_64/include/QtCore/qobject.h:344:32: note: in instantiation of member function 'QtPrivate::QFunctorSlotObject<void (RPCSocket::*)() noexcept, 0, QtPrivate::List<>, void>::QFunctorSlotObject' requested here
                                 new QtPrivate::QFunctorSlotObject<Func2, SlotArgumentCount,
                                     ^
      /home/eric/jenkins/workspace/PhysioFlow/software/staticAnalysis/Clang-Tidy/Core/../Common/rpcsocket.cpp:13:5: note: in instantiation of function template specialization 'QObject::connect<void (QIODevice::*)(), void (RPCSocket::*)() noexcept>' requested here
          connect(socket, &QIODevice::readyRead, this, &RPCSocket::clientData);
          ^
      /home/eric/Qt/5.7/gcc_64/include/QtCore/qobjectdefs_impl.h:632:42: error: member reference base type 'void (RPCSocket::*)() noexcept' is not a structure or union [clang-diagnostic-error]
              typedef decltype(dummy<Functor>().operator()((dummy<ArgList>())...)) Value;
                                               ^
      /home/eric/Qt/5.7/gcc_64/include/QtCore/qobject.h:309:37: note: in instantiation of template class 'QtPrivate::FunctorReturnType<void (RPCSocket::*)() noexcept, QtPrivate::List<> >' requested here
              typedef typename QtPrivate::FunctorReturnType<Func2, typename QtPrivate::List_Left<typename SignalType::Arguments, SlotArgumentCount>::Value>::Value SlotReturnType;
                                          ^
      /home/eric/jenkins/workspace/PhysioFlow/software/staticAnalysis/Clang-Tidy/Core/../Common/rpcsocket.cpp:13:5: note: in instantiation of function template specialization 'QObject::connect<void (QIODevice::*)(), void (RPCSocket::*)() noexcept>' requested here
          connect(socket, &QIODevice::readyRead, this, &RPCSocket::clientData);
      

      noexcept lambdas do not have this problem.

      It could be linked to http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            ericlemanissier Eric Lemanissier
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes