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

Static assertion failed with QVarLengthArray<std::vector<std::unique_ptr<int>>>

    XMLWordPrintable

Details

    • All
    • 5
    • 7c5ff43ea (dev), 26b227e12 (dev), 938712a99 (6.4), 5e3940dbd (6.4), 934764a7b (6.5), 54a82ed48 (6.5), 800ebd84f (dev), 89672efd5 (6.5), 17c6ee5a2 (6.4)
    • Foundation Sprint 72, Foundation Sprint 73

    Description

      Starting from Qt 6.4.0,  using

       QVarLengthArray<std::vector<std::unique_ptr<int>>>

      we hit an static assert in stl_uninitialized.h when using resize().

       
       /usr/include/c++/12.2.0/bits/stl_construct.h:115:28: error: no matching function for call to ‘construct_at(std::unique_ptr<AutoPanGroupState, std::default_delete<AutoPanGroupState> >*&, const std::unique_ptr<AutoPanGroupState, std::default_delete<AutoPanGroupState> >&)’
      115 | std::construct_at(_p, std::forward<_Args>(_args)...);

      ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       

      This is a regression since https://github.com/qt/qtbase/commit/a00a1d8806cfbf17e04b88d1b4ff4a9cf5b6294a#diff-3f4287973382b16af82c02e80740e5efbb0e5753771a19d6309eb2f7f6f6cd6d

       

      Because std::is_copy_constructible_v<T> is true in our case

      https://github.com/qt/qtbase/blob/067b53864112c084587fa9a507eb4bde3d50a6e1/src/corelib/tools/qvarlengtharray.h#L752

       

      see also https://godbolt.org/z/948xd73xT

       

      I think that can be solved by moving the value constructing version of

      reallocate_impl() into a new function and not use a nullptr to destinguish the cases.

       

      The original Bug has been reported here:

      https://github.com/mixxxdj/mixxx/issues/11167

      Attachments

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

        Activity

          People

            mmutz Marc Mutz
            daschuer Daniel Schürmann
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: