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

Compilation error on exported QList of Pointers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 6.0.0
    • 6.0
    • None
    • Windows 10, MSVC 2019 16.7
    • Windows
    • fc80bd201c7ee583254ec90eefcb16f550127cd1 (qt/qtbase/dev)

    Description

      I have a library with an exported QList of Pointers which fails to compile with Qt 6.

      minimal repro
      class Q_DECL_EXPORT MyList : public QList<int *>
      {
      };
      
      error message MSVC 2019 16.7/16.8
      src/corelib/tools/qlist.h(280): error C2440: 'initializing': cannot convert from 'QList<int *>::DisableRValueRefs' to 'T'
              with
              [
                  T=int *
              ]
      src/corelib/tools/qlist.h(280): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
      src/corelib/tools/qlist.h(278): note: while compiling class template member function 'void QList<int *>::replace(qsizetype,QList<int *>::DisableRValueRefs)'
      main.cpp(4): note: see reference to class template instantiation 'QList<int *>' being compiled
      
      error message MSVC 2017 15.9
      src/corelib/tools/qhashfunctions.h(198): error C3520: 'T': parameter pack must be expanded in this context
      mylist.cpp
      src/corelib/tools/qhashfunctions.h(198): error C3520: 'T': parameter pack must be expanded in this context
      

      When I remove the export macro (and add it to each method) or change the contained type from int * to int, the code compiles.

      Attachments

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

        Activity

          People

            laknoll Lars Knoll
            mkrems Marcel Krems
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes