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

qdoc doesn't recognize hidden friends as available APIs

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 6.1.0 RC
    • 6.0.0 Alpha
    • Build tools: qdoc
    • None
    • 5
    • 05ffeba75e90e226cd6ddf7d72cb9b9d0ad5f172 (qt/qttools/dev)
    • 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

        Issue Links

          For Gerrit Dashboard: QTBUG-86987
          # Subject Branch Project Status CR V

          Activity

            People

              treinio Topi Reiniƶ
              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