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

[dev] qtbase\tests\auto\corelib\tools\qhash\tst_qhash.cpp does not compile with MSCV2017

    XMLWordPrintable

Details

    • 2b44fb5c629807ba8d22ac5a2c0f9d76bbe5b6c9 (qtbase/dev, 19.7.2017, 5.10)

    Description

      MSVC does not accept constexpr for the operator==/!= of the newly introduced QKeyValueIterator

       friend Q_DECL_CONSTEXPR bool operator==(QKeyValueIterator lhs, QKeyValueIterator rhs) Q_DECL_NOEXCEPT { return lhs.i == rhs.i; }
      friend Q_DECL_CONSTEXPR bool operator!=(QKeyValueIterator lhs, QKeyValueIterator rhs) Q_DECL_NOEXCEPT { return lhs.i != rhs.i; }
      
      c:\dev\5-vs17-dev\qt-dev\qtbase\include\qtcore\../../src/corelib/tools/qiterator.h(201): error C3615: constexpr function 'operator !=' cannot result in a constant expression
      c:\dev\5-vs17-dev\qt-dev\qtbase\include\qtcore\../../src/corelib/tools/qiterator.h(201): note: failure was because type 'QKeyValueIterator<const Key &,const T &,QHash<Key,T>::const_iterator>' is not a literal type
              with
              [
                  Key=int,
                  T=int
              ]
      c:\dev\5-vs17-dev\qt-dev\qtbase\include\qtcore\../../src/corelib/tools/qiterator.h(210): note: type 'QKeyValueIterator<const Key &,const T &,QHash<Key,T>::const_iterator>' is not a literal type because its data member 'i' is of non-literal type 'QHash<int,int>::const_iterator'
              with
              [
                  Key=int,
                  T=int
              ]
      c:\dev\5-vs17-dev\qt-dev\qtbase\include\qtcore\../../src/corelib/tools/qhash.h(363): note: type 'QHash<int,int>::const_iterator' is not a literal type because it is not an aggregate type, a closure type, or does not have a constexpr constructor that is not a copy or move constructor
      c:\dev\5-vs17-dev\qt-dev\qtbase\include\qtcore\../../src/corelib/tools/qiterator.h(201): note: failure was because type 'QKeyValueIterator<const Key &,const T &,QHash<Key,T>::const_iterator>' is not a literal type
              with
              [
                  Key=int,
                  T=int
              ]
      c:\dev\5-vs17-dev\qt-dev\qtbase\include\qtcore\../../src/corelib/tools/qiterator.h(210): note: type 'QKeyValueIterator<const Key &,const T &,QHash<Key,T>::const_iterator>' is not a literal type because its data member 'i' is of non-literal type 'QHash<int,int>::const_iterator'
              with
              [
                  Key=int,
                  T=int
              ]
      c:\dev\5-vs17-dev\qt-dev\qtbase\include\qtcore\../../src/corelib/tools/qhash.h(363): note: type 'QHash<int,int>::const_iterator' is not a literal type because it is not an aggregate type, a closure type, or does not have a constexpr constructor that is not a copy or move constructor
      c:\dev\5-vs17-dev\qt-dev\qtbase\include\qtcore\../../src/corelib/tools/qiterator.h(201): note: failure was caused by call of undefined function or one not declared 'constexpr'
      c:\dev\5-vs17-dev\qt-dev\qtbase\include\qtcore\../../src/corelib/tools/qiterator.h(201): note: see usage of 'QHash<int,int>::const_iterator::operator !='
      c:\dev\5-vs17-dev\qt-dev\qtbase\include\qtcore\../../src/corelib/tools/qiterator.h(201): note: while compiling class template member function 'bool operator !=(QKeyValueIterator<const Key &,const T &,QHash<Key,T>::const_iterator>,QKeyValueIterator<const Key &,const T &,QHash<Key,T>::const_iterator>) noexcept'
              with
              [
                  Key=int,
                  T=int
              ]
      tst_qhash.cpp(1131): note: see reference to class template instantiation 'QKeyValueIterator<const Key &,const T &,QHash<Key,T>::const_iterator>' being compiled
              with
              [
                  Key=int,
                  T=int
              ]
      

      (see "Implement key-value iterator" ae292be8690109940fdd9862321b2389a0957404 https://codereview.qt-project.org/#/c/151511/ )

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            kleint Friedemann Kleint
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes