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

Concurrent takes pointers of addresses in namespace std::

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • None
    • 6.0.0 Beta1
    • Core: QtConcurrent
    • None
    • Windows

    Description

      In qtconcurrentstoredfunctioncall.h there's

          static constexpr decltype (auto) invokePointer()
          {
              return &std::invoke<std::decay_t<Function>, QPromise<PromiseType> &, std::decay_t<Args>...>;
          }
      

      This is undefined behavior https://eel.is/c++draft/library#namespace.std-6

      Let F denote a standard library function ([global.functions]), a standard library static member function, or an instantiation of a standard library function template.
      Unless F is designated an addressable function, the behavior of a C++ program is unspecified (possibly ill-formed) if it explicitly or implicitly attempts to form a pointer to F.

      And doesn't build on Windows under /permissive-

      https://testresults.qt.io/coin/integration/qt/qtbase/tasks/web_qt_qtbase_1603171941403

       C:\Users\qt\work\install\include\QtConcurrent/qtconcurrentstoredfunctioncall.h(92): error C3556: 'invoke': incorrect argument to 'decltype'
       
       16443:             T=double,
                   Function=std::reference_wrapper<void (__cdecl MyObject::* const )(QPromise<double> &) const>
               ]
       C:\Users\qt\work\install\include\QtConcurrent/qtconcurrentstoredfunctioncall.h(177): note: while compiling class template member function 'void QtConcurrent::StoredFunctionCallWithPromise<Function,PromiseType,_Ty>::runFunctor(void)'
               with
               [
                   Function=void (__cdecl MyObject::* )(QPromise<double> &) const,
                   PromiseType=PromiseType,
                   _Ty=const MyObject *
               ]
       C:\Users\qt\work\install\include\QtConcurrent/qtconcurrentstoredfunctioncall.h(92): error C3169: 'decltype(auto)': cannot deduce type for 'auto' from 'overloaded-function'
       
       16444:             Function=std::reference_wrapper<void (__cdecl MyObject::* const )(QPromise<double> &) const>
               ]
       C:\Users\qt\work\install\include\QtConcurrent/qtconcurrentstoredfunctioncall.h(177): note: while compiling class template member function 'void QtConcurrent::StoredFunctionCallWithPromise<Function,PromiseType,_Ty>::runFunctor(void)'
               with
               [
                   Function=void (__cdecl MyObject::* )(QPromise<double> &) const,
                   PromiseType=PromiseType,
                   _Ty=const MyObject *
               ]
      

      Attachments

        For Gerrit Dashboard: QTBUG-87719
        # Subject Branch Project Status CR V

        Activity

          People

            jkobus Jarek Kobus
            peppe Giuseppe D'Angelo
            Maurice Kalinowski Maurice Kalinowski
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes