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

moc generates reserved identifiers for scoped classes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.5.0, 6.6.0, 6.6
    • 6.3.1
    • Build tools: moc
    • None
    • e816f9154 (dev), f8c481e7e (6.5)

    Description

      Trying to enable and fix clang-tidy's bugprone-reserved-identifier on my codebase I found that the generated names for some type and variables in the moc output contains double underscores which are reserved names in the language.

      Quickly looking at the moc code generation (here: https://github.com/qt/qtbase/blob/dev/src/tools/moc/generator.cpp#L254) this comes from the scope columns being transformed into underscores.

      I'm not sure what the proper fix is:

      • replacing both "::" by a single underscore will still be wrong for "ns_::Class"
      • simply removing "::" will still be wrong for "ns_::_class"
      • using a placeholder like "x_qt_x" may work

      Attachments

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

        Activity

          People

            fabiankosmale Fabian Kosmale
            sjoubert Sylvain Joubert
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes