Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-42744 lupdate needs C++11 support
  3. QTBUG-76939

lupdate can not parse enum class forward declaration with underlying type

    XMLWordPrintable

Details

    • Technical task
    • Resolution: Duplicate
    • P2: Important
    • None
    • Tools: Linguist
    • None
    • All

    Description

      The summary already says everything.

      To reproduce, create a file similar to this:

       #include <QWidget>
      
      enum class EnumClassForwardDeclarationWithUnderlyingType : int;
      
      class SomeWidget : public QWidget
      
      { Q_OBJECT public: explicit SomeWidget(); }
      
      ;
      
      void SomeWidget::SomeWidget()
      
      { tr("foo"); }
      
      

      Calling lupdate on that file will produce the following error:

       lupdate lupdate.cpp 
       lupdate warning: no TS files specified. Only diagnostics will be produced.
       /tmp/lupdate.cpp:14: Qualifying with unknown namespace/class ::SomeWidget
      

      As a workaround one can use a macro, e.g.:

       #define TAGEDITOR_ENUM_CLASS enum class
       namespace TagParser
      
      { TAGEDITOR_ENUM_CLASS TagType : unsigned int; }
      
      // namespace TagParser
       #undef TAGEDITOR_ENUM_CLASS
      

      I only listed 5.13.0 as affected version because I only used that version to explicitely reproduce. But the issue likely affects all version.

      Attachments

        Issue Links

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

          Activity

            People

              kkohne Kai Köhne
              martchus martchus
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes