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

MOC compiler does not support strongly typed enum syntax

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 5.0.0 Beta 1
    • 4.7.4
    • Build tools: moc
    • None
    • Windows 7 x64
      Visual Studio 2010 Service Pack 1
      Qt 4.7.4

    Description

      Inside a class, I use the Q_ENUMS() macro to include an enumeration in Qt's meta-object system. I noticed that if I used the strongly typed enums feature from c++11, the moc compiler no longer includes the enum information into the generated .cxx file.

      example 1:
      class example1 : public QObject
      {
      Q_ENUMS( enum1 )

      public:
      enum enum1

      { enum1Val1 = 0, enum1Val2 }

      ;
      };

      example 2:
      class example2 : public QObject
      {
      Q_ENUMS( enum2 )

      public:
      enum enum2 : int

      { enum2Val1 = 0, enum2Val2 }

      ;
      };

      example 3:
      class example3 : public QObject
      {
      Q_ENUMS( enum3 )

      public:
      enum class enum3

      { enum3Val1 = 0, enum3Val2 }

      ;
      };

      example 4:
      class example4 : public QObject
      {
      Q_ENUMS( enum4 )

      public:
      enum class enum4 : int

      { enum4Val1 = 0, enum4Val2 }

      ;
      };

      Example 1 works with the moc compiler but examples 2, 3, and 4 do not. The code for examples for 2, 3, and 4 are valid for c++11.

      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)
            kreios4004 Keith Gardner
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes