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

Qt Moc doesn't recognize [[maybe_unused]] on enumeration

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 5.12.2
    • Build tools: moc
    • None
    • All

    Description

       

      // qtbase\bin\moc.exe -Iqtbase\include t.h -ot_moc.cpp
      #pragma once
      
      #include <QtCore/QObject>
      struct C final : public QObject {
      
       Q_OBJECT
      enum class E { V [[maybe_unused]] };
      };
      

       

      This code gives the following error:

       

      t.h(7): Parse error at "V" 
      

      This is considered valid c++ code according to cppreference: https://en.cppreference.com/w/cpp/language/attributes/maybe_unused and was recently used by clang to suppress warnings: https://bugs.llvm.org/show_bug.cgi?id=36231

       

      Attachments

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

        Activity

          People

            ogoffart Olivier Goffart (Woboq GmbH)
            jvapen Jeroen Van Antwerpen
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes