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

[qmltc] Possible enums redefinition (and compilation errors) in generated C++ code

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • 6.8
    • 6.6.3, 6.7.0, 6.8.0 FF
    • QML: Compiler, QML: Tooling
    • None

    Description

      When QML Type Compiler is used and multiple enumerations with the same value names are defined in the same QML file, an error occurs when compiling the generated C++ code.

      Source QML example:

      import QtQml
      
      QtObject {
          enum Paddings {
              S =     24,
              M =     32,
              L =     48,
              XL =    100
          }
          enum Margins {
              XS =    8,
              S =     12,
              M =     16,
              L =     20,
              XL =    32
          }
      }
      

      Compilation errors:

      C:/Users/Vladimir/Documents/My Qt Projects/build-qmltc_enum_bug-Qt_Dev-Debug/.qmltc/appqmltc_enum_bug/main.h(55): error C2365: 'qmltc_enum_bug::Main::S': redefinition; previous definition was 'enumerator'
      C:/Users/Vladimir/Documents/My Qt Projects/build-qmltc_enum_bug-Qt_Dev-Debug/.qmltc/appqmltc_enum_bug/main.h(47): note: see declaration of 'qmltc_enum_bug::Main::S'
      C:/Users/Vladimir/Documents/My Qt Projects/build-qmltc_enum_bug-Qt_Dev-Debug/.qmltc/appqmltc_enum_bug/main.h(56): error C2365: 'qmltc_enum_bug::Main::M': redefinition; previous definition was 'enumerator'
      C:/Users/Vladimir/Documents/My Qt Projects/build-qmltc_enum_bug-Qt_Dev-Debug/.qmltc/appqmltc_enum_bug/main.h(48): note: see declaration of 'qmltc_enum_bug::Main::M'
      C:/Users/Vladimir/Documents/My Qt Projects/build-qmltc_enum_bug-Qt_Dev-Debug/.qmltc/appqmltc_enum_bug/main.h(57): error C2365: 'qmltc_enum_bug::Main::L': redefinition; previous definition was 'enumerator'
      C:/Users/Vladimir/Documents/My Qt Projects/build-qmltc_enum_bug-Qt_Dev-Debug/.qmltc/appqmltc_enum_bug/main.h(49): note: see declaration of 'qmltc_enum_bug::Main::L'
      C:/Users/Vladimir/Documents/My Qt Projects/build-qmltc_enum_bug-Qt_Dev-Debug/.qmltc/appqmltc_enum_bug/main.h(58): error C2365: 'qmltc_enum_bug::Main::XL': redefinition; previous definition was 'enumerator'
      C:/Users/Vladimir/Documents/My Qt Projects/build-qmltc_enum_bug-Qt_Dev-Debug/.qmltc/appqmltc_enum_bug/main.h(50): note: see declaration of 'qmltc_enum_bug::Main::XL'
      

      See standalone example qmltc_enum_bug.zip

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            studiosus Vladimir Belyavsky
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes