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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Duplicate
    • Affects Version/s: 5.12.2
    • Fix Version/s: None
    • Component/s: Build tools: moc
    • Labels:
      None
    • Platform/s:
      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

            Assignee:
            ogoffart Olivier Goffart (Woboq GmbH)
            Reporter:
            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