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

MOC's preprocessing is not conformant

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.0
    • Fix Version/s: None
    • Component/s: Build tools: moc
    • Labels:
      None
    • Platform/s:
      All

      Description

      The following code causes MOC to choke:

      #include <QObject>
      
      namespace problem
      {
      
      #define FOR_EACH_ITEM( CALL ) \
        CALL( EXAMPLE ) \
        CALL( 123_EXAMPLE ) \
        CALL( OTHER_EXAMPLE )
      
      enum FooItems
      {
      
      #define ENUM_ITEM(NAME, ...) FOO ## NAME,
        FOR_EACH_ITEM( ENUM_ITEM )
      };
      
      }
      
      class Foo : public QObject
      {
        Q_OBJECT
      };
      

      The problem appears to be related to macro arguments that start with numbers. Output is:

      15: Parse error at "FOO123"
      

      This may be a regression versus 5.12. (Have not tested 5.13, but both 5.14 and 5.15 are affected.)

        Attachments

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

          Activity

            People

            Assignee:
            fabiankosmale Fabian Kosmale
            Reporter:
            matthew.woehlke Matthew Woehlke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes