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

MOC's preprocessing is not conformant

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.7.1, 6.8.0 FF
    • 5.15.0
    • Build tools: moc
    • None
    • All
    • 62d02c1d5 (dev), 1a1b1669f (6.7)

    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

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes