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

qglobal.h:121: error: static assertion failed: QMetaEnum::fromType only works with enums declared as Q_ENUM or Q_FLAG << Update this error message to also include Q_ENUM_NS

    XMLWordPrintable

Details

    • Linux/X11
    • 2ed4fcca196ac3fd34a3e41f2e0b3d346a5470b9 (qt/qtbase/5.12)

    Description

      I got this error message when I moved one of my enums into a namespace:

      Qt/5.12.1/gcc_64/include/QtCore/qglobal.h:121: error: static assertion failed: QMetaEnum::fromType only works with enums declared as Q_ENUM or Q_FLAG
       #  define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
                                                       ^
      

      I had to look online to discover that since 5.8, you have new macros:

      Q_NAMESPACE
      Q_ENUM_NS
      

      So you should update the error:

      qglobal.h:121: error: static assertion failed: QMetaEnum::fromType only works with enums declared as Q_ENUM, Q_FLAG, Q_ENUM_NS
      

      Attachments

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

        Activity

          People

            Eddy Edward Welbourne
            akiva Akiva Avraham
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes