Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-18916

Qt Creator autocompletion does not work with better-enums, produces fake "expected declaration" error after Q_ENUM_NS and BETTER_ENUMS(

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • Qt Creator 4.4.0
    • Qt Creator 4.2.0, Qt Creator 4.3.1, Qt Creator 4.4.0
    • C/C++/Obj-C++ Support
    • None

    Description

      I'm trying to use C++11 and better-enums to get to where I can define an enum and be able to grab the string knowing only the value, and iterate over them. I tried Q_ENUM_NS as well, which only works on 5.8 and above.

      Qt Creator does not auto complete or colorize any enum created by better-enums (using the BETTER_ENUMS() macro). Additionally, it shows an "expected a declaration" error after the first line, whether BETTER_ENUMS() is all on one line or split across multiple lines. It compiles and runs, but Qt Creator shows the error.

      I encountered the "expected a declaration" error with Q_ENUM_NS as well, but at least the IDE auto completed in that case. However, in some cases, I may be limited to 5.7.1, so I would like to get Qt Creator working better with better-enums.

      Posted here is an example project which reproduces the error as of Qt Creator 4.4.0 on Windows and 4.2.0 or 4.3.1 on Linux (raspberry pi running raspbian - stretch or testing, respectively)

      https://github.com/ftab/qt-enums-vs-better-enums/

      Attached are the screenshots depicting the described issue

      Attachments

        1. 42BC681A-2687-41B8-84CD-35EB00E8AB75.jpeg
          169 kB
          Dennis Field
        2. color_h.png
          43 kB
          Dennis Field
        3. main_cpp.png
          39 kB
          Dennis Field
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kosjar Nikolai Kosjar
            fury Dennis Field
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes