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

MSVC warns as error on stdext::checked_array_iterator in QtCore/qvector.h

    XMLWordPrintable

Details

    • Windows
    • 52b6258ec (dev), 24ca6bd11 (6.6), 2723b0312 (tqtc/lts-6.5), 521e059cd (tqtc/lts-6.2), 165daa88c (tqtc/lts-5.15)

    Description

      `QtCore/qvector.h` uses MSVC's `stdext::checked_array_iterator`:
      note: see reference to function template instantiation 'bool std::equal<const T*,stdext::checked_array_iterator<const T *>>(const _InIt1,const _InIt1,const _InIt2)' being compiled:

              with
              [
                  T=AttributeItem,
                  _InIt1=const AttributeItem *,
                  _InIt2=stdext::checked_array_iterator<const AttributeItem *>
              ] 

      After microsoft/STL#3818 ships in VS 2022 17.8 Preview 2, this will emit deprecation warnings (in C++17 mode and later). We want to discourage use of this non-Standard extension, towards eliminating it in a future version.

      MSVC's STL eliminated the incredibly annoying "copying to a raw pointer" warnings many versions ago (it was VS 2017 15.8, I believe), so you should simply be able to drop this usage of stdext::checked_array_iterator and use portable code for all platforms.

      Error:

       

      D:\installed\x64-windows\include\qt5\QtCore/qmetatype.h(621): note: see reference to class template instantiation 'QVector<QVariantMap>' being compiled
      D:\installed\x64-windows\include\qt5\QtCore/qvector.h(950): note: while compiling class template member function 'bool QVector<QVariantMap>::operator ==(const QVector<QVariantMap> &) const'
      D:\installed\x64-windows\include\qt5\QtCore/qmetatype.h(332): note: see the first reference to 'QVector<QVariantMap>::operator ==' in 'QtPrivate::BuiltInEqualsComparatorFunction<QVector<QVariantMap>>::equals'
      D:\installed\x64-windows\include\qt5\QtCore/qmetatype.h(327): note: see the first reference to 'QtPrivate::BuiltInEqualsComparatorFunction<QVector<QVariantMap>>::equals' in 'QtPrivate::BuiltInEqualsComparatorFunction<QVector<QVariantMap>>::BuiltInEqualsComparatorFunction'
      D:\installed\x64-windows\include\qt5\QtCore/qmetatype.h(620): note: see the first reference to 'QtPrivate::BuiltInEqualsComparatorFunction<QVector<QVariantMap>>::BuiltInEqualsComparatorFunction' in 'QMetaType::registerEqualsComparator'
      D:\installed\x64-windows\include\qt5\QtCore/qvector.h(958): note: see reference to function template instantiation 'bool std::equal<const T*,stdext::checked_array_iterator<const T *>>(const _InIt1,const _InIt1,const _InIt2)' being compiled
              with
              [
                  T=QVariantMap,
                  _InIt1=const QVariantMap *,
                  _InIt2=stdext::checked_array_iterator<const QVariantMap *>
              ]
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\xutility(5259): note: see reference to function template instantiation 'bool std::equal<_InIt1,_InIt2,std::equal_to<void>>(const _InIt1,const _InIt1,const _InIt2,_Pr)' being compiled
              with
              [
                  _InIt1=const QVariantMap *,
                  _InIt2=stdext::checked_array_iterator<const QVariantMap *>,
                  _Pr=std::equal_to<void>
              ]
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\xutility(5231): note: see reference to function template instantiation 'decltype(auto) std::_Get_unwrapped_n<const _InIt2&,__int64>(_Iter,const _Diff)' being compiled
              with
              [
                  _InIt2=stdext::checked_array_iterator<const QVariantMap *>,
                  _Iter=const stdext::checked_array_iterator<const QVariantMap *> &,
                  _Diff=__int64
              ]
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\xutility(1254): note: see reference to variable template 'const bool _Unwrappable_for_offset_v<stdext::checked_array_iterator<QMap<QString,QVariant> const *> const &>' being compiled
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\xutility(1248): note: see reference to variable template 'const bool _Unwrappable_v<stdext::checked_array_iterator<QMap<QString,QVariant> const *> const &,void>' being compiled
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\xutility(1175): note: see reference to variable template 'const bool _Allow_inheriting_unwrap_v<stdext::checked_array_iterator<QMap<QString,QVariant> const *>,void>' being compiled
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\__msvc_iter_core.hpp(190): error C4996: 'stdext::checked_array_iterator<const T *>': warning STL4043: stdext::checked_array_iterator, stdext::unchecked_array_iterator, and related factory functions are non-Standard extensions and will be removed in the future. std::span (since C++20) and gsl::span can be used instead. You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or _SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.
              with
              [
                  T=QVariantMap
              ]
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\iterator(1470): note: see declaration of 'stdext::checked_array_iterator'
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\__msvc_iter_core.hpp(190): note: the template instantiation context (the oldest one first) is
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\xutility(1243): note: see reference to alias template instantiation 'std::_Iter_diff_t<stdext::checked_array_iterator<const T *>>' being compiled
              with
              [
                  T=QVariantMap
              ]
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\xutility(1056): note: see reference to alias template instantiation 'std::iter_difference_t<stdext::checked_array_iterator<const T *>>' being compiled
              with
              [
                  T=QVariantMap
              ]
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\__msvc_iter_core.hpp(120): note: see reference to variable template 'bool _Is_from_primary<std::iterator_traits<stdext::checked_array_iterator<QMap<QString,QVariant> const *> > >' being compiled
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\__msvc_iter_core.hpp(114): note: see reference to class template instantiation 'std::iterator_traits<stdext::checked_array_iterator<const T *>>' being compiled
              with
              [
                  T=QVariantMap
              ]
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\__msvc_iter_core.hpp(373): note: see reference to class template instantiation 'std::_Iterator_traits_base<_Ty>' being compiled
              with
              [
                  _Ty=stdext::checked_array_iterator<const QVariantMap *>
              ]
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\__msvc_iter_core.hpp(190): error C4996: 'stdext::checked_array_iterator<const T *>::iterator_category': warning STL4043: stdext::checked_array_iterator, stdext::unchecked_array_iterator, and related factory functions are non-Standard extensions and will be removed in the future. std::span (since C++20) and gsl::span can be used instead. You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or _SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.
              with
              [
                  T=QVariantMap
              ]
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\__msvc_iter_core.hpp(191): error C4996: 'stdext::checked_array_iterator<const T *>': warning STL4043: stdext::checked_array_iterator, stdext::unchecked_array_iterator, and related factory functions are non-Standard extensions and will be removed in the future. std::span (since C++20) and gsl::span can be used instead. You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or _SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.
              with
              [
                  T=QVariantMap
              ]
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\iterator(1470): note: see declaration of 'stdext::checked_array_iterator'
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\__msvc_iter_core.hpp(191): error C4996: 'stdext::checked_array_iterator<const T *>::value_type': warning STL4043: stdext::checked_array_iterator, stdext::unchecked_array_iterator, and related factory functions are non-Standard extensions and will be removed in the future. std::span (since C++20) and gsl::span can be used instead. You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or _SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.
              with
              [
                  T=QVariantMap
              ]
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\__msvc_iter_core.hpp(192): error C4996: 'stdext::checked_array_iterator<const T *>': warning STL4043: stdext::checked_array_iterator, stdext::unchecked_array_iterator, and related factory functions are non-Standard extensions and will be removed in the future. std::span (since C++20) and gsl::span can be used instead. You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or _SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.
              with
              [
                  T=QVariantMap
              ]
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\iterator(1470): note: see declaration of 'stdext::checked_array_iterator'
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\__msvc_iter_core.hpp(192): error C4996: 'stdext::checked_array_iterator<const T *>::difference_type': warning STL4043: stdext::checked_array_iterator, stdext::unchecked_array_iterator, and related factory functions are non-Standard extensions and will be removed in the future. std::span (since C++20) and gsl::span can be used instead. You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or _SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.
              with
              [
                  T=QVariantMap
              ]
      C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\__msvc_iter_core.hpp(179): error C4996: 'stdext::checked_array_iterator<const T *>': warning STL4043: stdext::checked_array_iterator, stdext::unchecked_array_iterator, and related factory functions are non-Standard extensions and will be removed in the future. std::span (since C++20) and gsl::span can be used instead. You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or _SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.
              with
              [
                  T=QVariantMap
              ] 

       

      Attachments

        1. databasemanager.i
          7.03 MB
          Frank Xoe

        Issue Links

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

          Activity

            People

              manordheim Mårten Nordheim
              frankxie Frank Xoe
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes