https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122625

--- Comment #10 from d7d1cd <d7d1cd at mail dot ru> ---
Thanks for the correction, but there's a caveat...

If you add the -Wall -Werror -O0 compilation options to the original example,
it links successfully (https://godbolt.org/z/4r59razqc). However, if you
specify -O2 or -O3 optimization (https://godbolt.org/z/3fsxc1Tx1), you'll get a
warning:

    include/c++/16.0.0/bits/stl_iterator.h:1111:16: error: array subscript 2 
    is outside array bounds of 'const char32_t [1]' [-Werror=array-bounds=]
    1111 |       { return __normal_iterator(_M_current++); }

    include/c++/16.0.0/format:847:28: note: at offset 8 into object '__arr'
    of size 4
    847 |             const char32_t __arr[1]{ __fill_char };


Compiler 15.2 doesn't have this problem.

Reply via email to