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

clang shorten-64-to-32 warning in qmlcachegen code

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 6.5.3, 6.6.3
    • QML: Compiler
    • None
    • All

    Description

      Given this C++ and QML code:

      signals:
           void captureAndScanFinished(const QVariantList &items); 
      onCaptureAndScanFinished: function(items) {
           console.log("scanned", items.length)
      }

      The compiler generates this code, which clang on macOS, iOS and Android rightfully complains about:

      ...
      QVariantList r6_0 = (*static_cast<QVariantList*>(argumentsPtr[0]));
      QString r11_0;
      QVariantList r2_1;
      QString r2_0;
      QString r12_0;
      // generate_LoadRuntimeString
      r2_0 = QStringLiteral("scanned");
      // generate_StoreReg
      r11_0 = std::move(r2_0);
      // generate_LoadReg
      r2_1 = std::move(r6_0);
      // generate_GetLookup
      {
      int retrieved;
      retrieved = r2_1.length();   //!!!!!!!!!!!!!! HERE, LINE 1697
      r2_0 = QJSPrimitiveValue(retrieved).toString();
      }
      ...

      with

      .../.rcc/qmlcache/mobile_module_ItemScannerDialog_qml.cpp:1697:18: error: implicit conversion loses integer precision: 'qsizetype' (aka 'long long') to 'int' [-Werror,-Wshorten-64-to-32]
      retrieved = r2_1.length();
                ~ ~~~~~^~~~~~~~ 

       

      Attachments

        Issue Links

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

          Activity

            People

              qtqmlteam Qt Qml Team User
              rgriebl Robert Griebl
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes