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

Function signature matching does not ignore top level const

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • Qt Creator 7.0.2, Qt Creator 8.0.0-beta1, Qt Creator 8.0.0-beta2, Qt Creator 8.0.0-rc1, Qt Creator 8.0.0
    • C/C++/Obj-C++ Support
    • Linux/X11

    Description

      Given a function prototype of:

      void foo(bool);

      in some header file, and an implementation of that function in a source file that looks like this:

      void foo(const bool) { }

      Creator does not recognize the implementation of the function. Placing the cursor on it does not highlight it, and when using the "find references to symbol under cursor" functionality, no matches are found.

      Removing the const makes Creator recognize it, but that obviously is not an acceptable workaround. Omitting top-level const in prototypes is a very common practice. It's of no interest whatsoever to the caller and would just pollute the header files, especially with code that tries to be as const-correct as possible.

      Attachments

        1. highlighting.png
          highlighting.png
          33 kB
        2. no-highlight.mp4
          67 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kandeler Christian Kandeler
            realnc Nikos Chantziaras
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes