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

moc asserts on empty token preceding ## operator

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.9.0 Beta 2
    • 5.8.0
    • Build tools: moc
    • None
    • Windows 10/64bit

    Description

      moc crashes with an !isEmpty() assertion in QVector when preprocessing a file involving a ## operator with a left-hand side containing only whitespace in the dev branch. The expansions vector is emptied of all tokens and then constLast() is invoked on the empty vector.

      This pattern is used in the standard type_traits header in upcoming releases of MSVC (as yet unreleased, but an upcoming preview of the next version of VS will contain this change). It's expressly permitted by the standard (see 16.3.3/p2 "If an argument consists of no preprocessing tokens, the parameter is replaced by a placemaker preprocessing token instead").

      Attached is a small repro case that compiles with all of VC++, gcc, and clang but asserts with the debug moc in the dev or 5.8 branch. It does not crash in the 5.7 branch.

      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)
            jcemmett Jonathan Emmett
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes