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

QStringList forward declaration raise compilation errors with QDOC disabled

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P4: Low
    • None
    • 6.5.3
    • Core: Other
    • None
    • Linux/X11

    Description

      Trying to upgrade to QT 6 on a project of mine, I am getting errors like this:

      /usr/include/qt6/QtCore/qcontainerfwd.h:34:7: error: conflicting declaration 'using QStringList = class QList<QString>'

      in files with forward declarations for <QStringList>, see for example the sample minimal project I attached.

      Now, I noticed that in that header the definition is guarded by a Q_QDOC conditional:

      #ifndef Q_QDOC
      template<typename T> using QVector = QList<T>;
      using QStringList = QList<QString>;
      class QByteArray;
      using QByteArrayList = QList<QByteArray>;
      #else
      template<typename T> class QVector;
      class QStringList;
      class QByteArrayList;
      #endif
      

      but I don't know why the two branches get a different definition; however, I am not compiling Qt with QDOC so this seems to be relevant.

      Can you tell me if this is an actual QT bug (maybe your builds are usually done WITH QDOC and this path does not get often tested) or I missed some documentation that says in Qt 6 you are not supposed to use simple forward declarations like:

      class QStringList;
      

      in a header?

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            giallu_ Gianluca Sforna
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes