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

Compilation error with c++20 in gcc 10

    XMLWordPrintable

Details

    Description

      Fix for QTBUG-130643 broke gcc 10..2.1.

      #include <QList>
      int main() {
       QList<int> i;
       i.rend();
      }
      
      g++ -c -pipe -O2 -std=gnu++2a -Wall -Wextra -fPIC -D_REENTRANT -DQT_NO_DEBUG -DQT_CORE_LIB -I. -I../Qt/6.8.1/gcc_64/include -I../Qt/6.8.1/gcc_64/include/QtCore -I. -I../Qt/6.8.1/gcc_64/mkspecs/linux-g++ -o main.o main.cpp
      In file included from /usr/include/c++/10/bits/stl_iterator_base_types.h:71,
                       from /usr/include/c++/10/bits/stl_algobase.h:65,
                       from /usr/include/c++/10/array:40,
                       from /usr/include/c++/10/tuple:39,
                       from ../Qt/6.8.1/gcc_64/include/QtCore/qttypetraits.h:11,
                       from ../Qt/6.8.1/gcc_64/include/QtCore/qforeach.h:11,
                       from ../Qt/6.8.1/gcc_64/include/QtCore/qglobal.h:57,
                       from ../Qt/6.8.1/gcc_64/include/QtCore/qpair.h:8,
                       from ../Qt/6.8.1/gcc_64/include/QtCore/qarraydata.h:8,
                       from ../Qt/6.8.1/gcc_64/include/QtCore/qarraydataops.h:8,
                       from ../Qt/6.8.1/gcc_64/include/QtCore/qarraydatapointer.h:7,
                       from ../Qt/6.8.1/gcc_64/include/QtCore/qlist.h:8,
                       from ../Qt/6.8.1/gcc_64/include/QtCore/QList:1,
                       from main.cpp:1:
      /usr/include/c++/10/bits/iterator_concepts.h: In substitution of ‘template<class _Tp> using __iter_value_t = typename std::__detail::__iter_traits_impl<_Tp, std::indirectly_readable_traits<_Iter> >::type::value_type [with _Tp = QList<int>::iterator]’:
      /usr/include/c++/10/bits/iterator_concepts.h:259:11:   required by substitution of ‘template<class _Tp> using iter_value_t = std::__detail::__iter_value_t<typename std::remove_cv<typename std::remove_reference<_Tp>::type>::type> [with _Tp = QList<int>::iterator]’
      /usr/include/c++/10/bits/iterator_concepts.h:491:11:   required from ‘class std::reverse_iterator<QList<int>::iterator>’
      main.cpp:5:9:   required from here
      /usr/include/c++/10/bits/iterator_concepts.h:254:13: error: ambiguous template instantiation for ‘struct std::indirectly_readable_traits<QList<int>::iterator>’
        254 |       using __iter_value_t = typename
            |             ^~~~~~~~~~~~~~
      /usr/include/c++/10/bits/iterator_concepts.h:242:12: note: candidates are: ‘template<class _Tp>  requires requires{typename _Tp::value_type;} struct std::indirectly_readable_traits<_Iter> [with _Tp = QList<int>::iterator]’
        242 |     struct indirectly_readable_traits<_Tp>
            |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/c++/10/bits/iterator_concepts.h:247:12: note:                 ‘template<class _Tp>  requires requires{typename _Tp::element_type;} struct std::indirectly_readable_traits<_Iter> [with _Tp = QList<int>::iterator]’
        247 |     struct indirectly_readable_traits<_Tp>
            |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      make: *** [Makefile:775: main.o] Error 1
      

      Attachments

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              poikelin Joni Poikelin
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes