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

P0883 change to C++ standard breaks Qt Creator build on MSVC++

    XMLWordPrintable

Details

    • Windows
    • 7af5619836cb3bd2eca87fd10b81674c9e201e76 (qt/qtbase/5.14) c6aec7eda396093616a8d7b71df8e029b885ffc3 (qt/qtbase/5.12)

    Description

      In P0883 the C++ standard changed the behavior of atomic<T> to value-initialize the T (that is, if T is an integer, set that integer to 0 when the atomic is constructed).

      We recently implemented P0883 in the MSVC++ STL unconditionally so that projects pick up this safety enhancement: https://github.com/microsoft/STL/pull/390

      This causes the Qt Creator build to fail with a linker error:

      timelinemodel.obj : error LNK2019: unresolved external symbol "_declspec(dllimport) public: __thiscall QLinkedListData::QLinkedListData(void)" (imp??0QLinkedListData@@QAE@XZ) referenced in function "private: class QLinkedList<int>::iterator __thiscall QLinkedList<int>::detach_helper2(class QLinkedList<int>::iterator)" (?detach_helper2@?$QLinkedList@H@@AAE?AViterator@1@V21@@Z)
      

      This is because Qt is attempting to dllexport/dllimport STL types, in this case std::atomic, which is not technically a supported scenario (e.g. we add member functions, as we did here, which will affect the resulting export surface). The dllexport/dllimport is in that Q_CORE_EXPORT macro on the QLinkedListData type here: https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/tools/qlinkedlist.h#n61

      I would submit a patch to fix this but I'm unaware how Qt owners would like to proceed. Ideally, whatever core package on which Qt Creator depends would be rebuilt which would pick up the newly exported default constructor, and that's it (there would be no changes to the sources at all). If that is not possible for some reason we can discuss workarounds.

      I note that the C++ standard is effectively mandating

      QT_BASIC_ATOMIC_HAS_CONSTRUCTORS behavior post this change.

      Billy O'Neal

      Visual C++ Libraries

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            billyoneal Billy ONeal
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes