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

"Follow Symbol under Cursor" (F2) does not work for functions with different reference qualifiers

    XMLWordPrintable

Details

    • Windows

    Description

      When I have a code that uses different methods with the same name (e.g. string()) but different reference qualifiers (const & vs const &&), the tooltip shows the right method declaration if I hover of the code where the specific method is called.

      But if I put the cursor in the specific method and press "F2" to get to the specific definition it always jumps to one definition, but never the other.

      Example (full code attached):

       

      // part of base.cpp
      const QString& Base::string() const &
         {
         qDebug() << Q_FUNC_INFO;
         return _string;
         }
      
      // THIS IS THE METHOD WHERE "F2" JUMPS TO
      QString Base::string() const &&
         {
         qDebug() << Q_FUNC_INFO;
         return std::move(_string);
         }
      
      // part of main.cpp
      Base baseFactory()
         {
         Base result;
         result._string = "factorized";
         return result;
         }
      
      int main(int , char *[])
         {
         Base myBase1;
         qDebug() << "\ndebug output string from simple base";
         qDebug() << myBase1.string();       // put cursor in string() and press "F2"
      
         qDebug() << "\ndebug output string from factory result";
         qDebug() << baseFactory().string(); // put cursor in string() and press "F2"
      
         return 0;
         }

       

      I would expect to jump the respective definition.

       

      As a side note: 

      Refactoring one string() method to get getString() proposes both string() declarations/definitions to be changed.

      Should this be a different issue or has this the same reason?

       

      Attachments

        Activity

          People

            kandeler Christian Kandeler
            moellney Michael Möllney
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: