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

QVector compile error with QT_STRICT_ITERATORS (regression)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.3.0
    • 5.0.1
    • None
    • Windows 7 VS2010
    • 1c63909ad8caee11ba0ec4af998d981bd50d3ee1

    Description

      There is a compile error when building the code below.

      #define QT_STRICT_ITERATORS
      #include <QVector>
      
      int main()
      {
          QVector<int> v;
          v.push_back(0);
          v.erase(v.begin());
          return 0;
      }
      

      This is the error:

      d:\visualstudio2010\qtcommercial5.0.1_32bit\5.0.1\msvc2010\include\qtcore\qvector.h(617) : error C2839: invalid return type 'int *' for overloaded 'operator ->'
      d:\visualstudio2010\qtcommercial5.0.1_32bit\5.0.1\msvc2010\include\qtcore\qvector.h(594) : while compiling class template member function 'QTypedArrayData<T>::iterator QVector<T>::erase(QTypedArrayData<T>::iterator,QTypedArrayData<T>::iterator)'
      with
      [
      T=int
      ]
      main.cpp(6) : see reference to class template instantiation 'QVector<T>' being compiled
      with
      [
      T=int
      ]
      d:\visualstudio2010\qtcommercial5.0.1_32bit\5.0.1\msvc2010\include\qtcore\qvector.h(617) : error C2300: 'QTypedArrayData<T>::iterator' : class does not have a destructor called '~T'
      with
      [
      T=int
      ]
      

      The same code compiles correctly with Qt 4.8.4.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes