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

qtestmouse.h(231) : warning C4701: potentially uninitialized local variable 'meType' used

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.2.1
    • Testing: qtestlib
    • None
    • Windows 10/Windows 2016 Server.
      Microsoft Visual Studio 2019
    • Windows

    Description

      Compiling code that includes qtestmouse.h generates a warning on MSVC 2019:

      qtestmouse.h(231) : warning C4701: potentially uninitialized local variable 'meType' used

      While I found this on Qt 6.2.1, it looks like the dev branch still has this uninitialized variable. https://code.qt.io/cgit/qt/qtbase.git/tree/src/testlib/qtestmouse.h

      The relevant code excerpt is below. 

       

              QEvent::Type meType;
              Qt::MouseButton meButton;
              switch (action)
              {
                  case MousePress:
                      meType = QEvent::MouseButtonPress;
                      meButton = button;
                      break;
                  case MouseRelease:
                      meType = QEvent::MouseButtonRelease;
                      meButton = Qt::MouseButton();
                      break;
                  case MouseDClick:
                      meType = QEvent::MouseButtonDblClick;
                      meButton = button;
                      break;
                  case MouseMove:
                      QCursor::setPos(widget->mapToGlobal(pos));
                      qApp->processEvents();
                      return;
                  default:
                      QTEST_ASSERT(false);
              }
              QMouseEvent me(meType, pos, widget->mapToGlobal(pos), button, meButton, stateKey, QPointingDevice::primaryPointingDevice());
      
      

       

      Attachments

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

        Activity

          People

            macadder Jason McDonald
            michaeldurland Michael Durland
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes