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

qdoc doesn't recognize hidden friends as available APIs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 6.0.0 Alpha
    • Fix Version/s: None
    • Component/s: Build tools: qdoc
    • Labels:
      None
    • Commits:
      05ffeba75e90e226cd6ddf7d72cb9b9d0ad5f172 (qt/qttools/dev)
    • Story Points:
      5
    • Sprint:
      Da Vinci sprint 18

      Description

      QMap::iterator declares and implements operator== and operator!= has hidden friends in the declaration of QMap::iterator in qmap.h:

              friend bool operator==(const iterator &lhs, const iterator &rhs) { return lhs.i == rhs.i; }
              friend bool operator!=(const iterator &lhs, const iterator &rhs) { return lhs.i != rhs.i; }
      

      When documentation those as either member functions, or non-member functions:

      /*!
          \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator==(const iterator &lhs, const iterator &rhs)
          \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator==(const const_iterator &lhs, const const_iterator &rhs)
      
          Returns \c true if \a lhs points to the same item as the \a rhs iterator;
          otherwise returns \c false.
      
          \sa operator!=()
      */
      
      /*!
          \fn template <class Key, class T> bool operator!=(const QMap<Key, T>::iterator &lhs, const QMap<Key, T>::iterator &rhs)
          \fn template <class Key, class T> bool operator!=(const QMap<Key, T>::const_iterator &lhs, const QMap<Key, T>::const_iterator &rhs)
      
          Returns \c true if \a lhs points to a different item than the \a rhs iterator;
          otherwise returns \c false.
      
          \sa operator==()
      */
      

      qdoc warns either way:

      /Users/vohi/qt/dev/qtbase/src/corelib/tools/qmap.qdoc:921: (qdoc) warning: clang couldn't find function when parsing \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator==(const iterator &lhs, const iterator &rhs)
      /Users/vohi/qt/dev/qtbase/src/corelib/tools/qmap.qdoc:921: (qdoc) warning: clang couldn't find function when parsing \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator==(const const_iterator &lhs, const const_iterator &rhs)
      /Users/vohi/qt/dev/qtbase/src/corelib/tools/qmap.qdoc:931: (qdoc) warning: clang couldn't find function when parsing \fn template <class Key, class T> bool operator!=(const QMap<Key, T>::iterator &lhs, const QMap<Key, T>::iterator &rhs)
      /Users/vohi/qt/dev/qtbase/src/corelib/tools/qmap.qdoc:931: (qdoc) warning: clang couldn't find function when parsing \fn template <class Key, class T> bool operator!=(const QMap<Key, T>::const_iterator &lhs, const QMap<Key, T>::const_iterator &rhs)
      

      In C++, a friend declared within a class generally should not be considered a member of the class. I believe this is the case for hidden friends as well, as they can be declared in the private section of a class. So, option for operator!= would be correct.

        Attachments

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

          Activity

            People

            Assignee:
            treinio Topi Reiniƶ
            Reporter:
            vhilshei Volker Hilsheimer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes