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

Generated QML code doesn't compile with -Wshadow -Werror

    XMLWordPrintable

Details

    • b7b63ba92 (dev), 039c48b0e (6.6), bca9e06ac (6.5)

    Description

      Attached a simple QML example with a Loader. Building this example with a standard cmake setup works fine.

      Enabling the -Werror and -Wshadow flags causes a compilation failure:

      /home/gagi/work/tests/build-qml_wshadow-Desktop_Qt_6_6_0_GCC_64bit-Debug/.rcc/qmlcache/appqml_wshadow_Main_qml.cpp: In lambda function:
      /home/gagi/work/tests/build-qml_wshadow-Desktop_Qt_6_6_0_GCC_64bit-Debug/.rcc/qmlcache/appqml_wshadow_Main_qml.cpp:259:114: error: declaration of ‘void** argumentsPtr’ shadows a parameter [-Werror=shadow]
        259 |         wrapCall(aotContext, dataPtr, argumentsPtr, [](const QQmlPrivate::AOTCompiledContext *aotContext, void **argumentsPtr) {
            |                                                                                                           ~~~~~~~^~~~~~~~~~~~
      /home/gagi/work/tests/build-qml_wshadow-Desktop_Qt_6_6_0_GCC_64bit-Debug/.rcc/qmlcache/appqml_wshadow_Main_qml.cpp:258:81: note: shadowed declaration is here
        258 |     [](const QQmlPrivate::AOTCompiledContext *aotContext, void *dataPtr, void **argumentsPtr) {
            |                                                                          ~~~~~~~^~~~~~~~~~~~
      /home/gagi/work/tests/build-qml_wshadow-Desktop_Qt_6_6_0_GCC_64bit-Debug/.rcc/qmlcache/appqml_wshadow_Main_qml.cpp:259:95: error: declaration of ‘const QQmlPrivate::AOTCompiledContext* aotContext’ shadows a parameter [-Werror=shadow]
        259 |         wrapCall(aotContext, dataPtr, argumentsPtr, [](const QQmlPrivate::AOTCompiledContext *aotContext, void **argumentsPtr) {
            |                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
      /home/gagi/work/tests/build-qml_wshadow-Desktop_Qt_6_6_0_GCC_64bit-Debug/.rcc/qmlcache/appqml_wshadow_Main_qml.cpp:258:47: note: shadowed declaration is here
        258 |     [](const QQmlPrivate::AOTCompiledContext *aotContext, void *dataPtr, void **argumentsPtr) {
            |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
      cc1plus: all warnings being treated as errors
      

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            gagi Dominik Holland
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes