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

Invalid code generated for comparison

    XMLWordPrintable

Details

    • bce216d5c0 (qt/qtdeclarative/dev) bce216d5c0 (qt/tqtc-qtdeclarative/dev) 39aba03d4c (qt/qtdeclarative/6.4) 39aba03d4c (qt/tqtc-qtdeclarative/6.4)

    Description

          property var v: null
          Component.onCompleted: {
              var g = null
              if (g !== null) {}
          }
      

      will fail with a compile error:

      /foo/minipdf_main_qml.cpp:223:9: error: expected primary-expression before ‘!=’ token
        223 | r2_1 =  != ;
            |         ^~
      /foo/minipdf_main_qml.cpp:223:12: error: expected primary-expression before ‘;’ token
        223 | r2_1 =  != ;
            |            ^
      

      generated code in the .cpp file looks like this:

      extern const QQmlPrivate::AOTCompiledFunction aotBuiltFunctions[] = {
      { 0, QMetaType::fromType<void>(), {  }, 
          [](const QQmlPrivate::AOTCompiledContext *aotContext, void *dataPtr, void **argumentsPtr) {
              wrapCall(aotContext, dataPtr, argumentsPtr, [](const QQmlPrivate::AOTCompiledContext *aotContext, void **argumentsPtr) {
      Q_UNUSED(aotContext);
      Q_UNUSED(argumentsPtr);
      bool r2_1;
      // Component.onCompleted: {
      // generate_CreateCallContext
      {
      // var g = null
      // if (g !== null) {}
      // generate_CmpStrictNotEqual
      r2_1 =  != ;
      // generate_JumpFalse
      if (!r2_1) ;
      // generate_PopContext
      ;}
      // generate_Ret
      return;
      });}
       },{ 0, QMetaType::fromType<void>(), {}, nullptr }};
      QT_WARNING_POP
      }
      }
      

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            poikelin Joni Poikelin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes