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

moc parse error around namespace concatenation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.11.1
    • Build tools: moc
    • None
    • CMake 3.12.3 (autogen enabled)
      Visual Studio 2015 Update 3 (cmake generated)
    • Windows

      Somehow moc parser does not know how to parse these concat macro implementation:

      #define CONCAT_(v1, v2) v1 ## v2
      #define CONCAT(v1, v2) CONCAT_(v1, v2)
      #define CONCAT3(v1, v2, v3) CONCAT(v1, CONCAT(v2, v3))
      
      #define TEST(a, b, c) namespace CONCAT3(a, b, c)
      
      #define MYTOKEN x_y_z
      
      TEST(aaa, bbb, MYTOKEN) // Parse error at "aaabbbx_y_z"
      

      This only reproduces with the `namespace` in a macro. If try to roll out the macro or replace the `namespace` to something like `extern int` then the error does disappear.

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

            ogoffart Olivier Goffart (Woboq GmbH)
            Andry Andrey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes