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

Size conversion warnings using QList<>

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.4.0 RC
    • 5.3.1
    • None
    • Windows 7 64-bit, compiling with MSVC 2013, using 64-bit Qt 5.
    • c28045b118dcc139992ab5cd5028b94980942080

    Description

      On 64-bit MSVC compilations, when using any operation that offsets the iterator of a QList<>, size conversion warnings are emitted.

      This may be because QList<>::iterator uses sizeof(qptrdiff) for the difference_type, but uses the int type for the operator+ and operator-.

      sizeof(qptrdiff) == 8, but sizeof(int) == 4.

      Example code:

      #include <QList>
      #include <algorithm>
      
      int main(int, char**)
      {
          QList<int> l;
          std::stable_sort(l.begin(), l.end());
      }
      

      First warning:
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xutility(690) : warning C4244: 'argument' : conversion from '__int64' to 'int', possible loss of data

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            chard Richard Hazlewood
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes