On 01/08/20 00:49 +0200, Martin Jambor wrote:
Hi Jonathan,

On Wed, Jul 22 2020, Jonathan Wakely via Gcc-patches wrote:
libstdc++-v3/ChangeLog:

        * include/bits/stl_iterator.h (reverse_iterator): Constrain
        converting constructor and converting assignment operator.
        Access source iterator's data member directly instead of
        calling base().
        (move_iterator): Likewise.
        * testsuite/24_iterators/move_iterator/dr3435.cc: New test.
        * testsuite/24_iterators/reverse_iterator/dr3435.cc: New test.

Tested powerpc64le-linux, committed to trunk.


with this patch, I fail to build 541.leela_r from SPEC INT 2017 even
when I specifically pass -std=c++98 to all compiler invocations.  Is
that expected?

A simple reproducer is:

------------------------------ aaa.cpp ------------------------------
#include <vector>

typedef unsigned long long int uint64;
std::vector<uint64> ko_hash_history;
uint64 ko_hash;

bool bar(std::vector<uint64>::const_reverse_iterator fisrst,
        std::vector<uint64>::const_reverse_iterator last,
        std::vector<uint64>::const_reverse_iterator res);

bool foo(void) {
   std::vector<uint64>::const_reverse_iterator first = ko_hash_history.rbegin();
   std::vector<uint64>::const_reverse_iterator last = ko_hash_history.rend();
   std::vector<uint64>::const_reverse_iterator res;

   return bar(first, last, res);
}
----------------------------------------------------------------------

$ /home/mjambor/gcc/mine/inst/bin/g++ -std=c++98 -m64 -c -O2 -g aaa.cpp

In file included from 
/home/mjambor/gcc/mine/inst/include/c++/11.0.0/bits/stl_algobase.h:67,
                from /home/mjambor/gcc/mine/inst/include/c++/11.0.0/vector:60,
                from aaa.cpp:1:
/home/mjambor/gcc/mine/inst/include/c++/11.0.0/bits/stl_iterator.h: In instantiation of 
‘std::reverse_iterator<_Iterator>::reverse_iterator(const std::reverse_iterator<_Iter>&) [with _Iter = 
__gnu_cxx::__normal_iterator<long long unsigned int*, std::vector<long long unsigned int> >; _Iterator = 
__gnu_cxx::__normal_iterator<const long long unsigned int*, std::vector<long long unsigned int> >]’:
aaa.cpp:12:80:   required from here
/home/mjambor/gcc/mine/inst/include/c++/11.0.0/bits/stl_iterator.h:203:23: error: 
‘__gnu_cxx::__normal_iterator<long long unsigned int*, std::vector<long long unsigned int> > 
std::reverse_iterator<__gnu_cxx::__normal_iterator<long long unsigned int*, std::vector<long long 
unsigned int> > >::current’ is protected within this context
 203 |         : current(__x.current) { }
     |                   ~~~~^~~~~~~
/home/mjambor/gcc/mine/inst/include/c++/11.0.0/bits/stl_iterator.h:146:17: 
note: declared protected here
 146 |       _Iterator current;
     |                 ^~~~~~~

...which is exactly the error I get from leela.  The error goes away
when I use -std=c++11 instead (I promise I'll switch to building my
benchmarks with that or c++14 over the remaining of this year :-).

Is there a problem in the test (and the benchmark)?  Should I file a PR?

FTR I replied to Martin off-list, pointing out this was already filed
as https://gcc.gnu.org/PR96382 and is fixed already.


Reply via email to