A: a new bug to old plain C

Jonathan Wakely jwakely.gcc@gmail.com
Fri Nov 21 11:47:18 GMT 2025


On Fri, 21 Nov 2025 at 03:25, Chris S via Gcc-help <gcc-help@gcc.gnu.org> wrote:
>
> You're applying two consts to the same thing, so it's an error.

No, that's not happening here.

The explanation is
https://isocpp.org/wiki/faq/const-correctness#constptrptr-conversion

>
> "Const int" and "int const" are the same (look up East vs West const), but
> "const int const" is an error.  Declaring a pointer to that invalid type
> declaration is still invalid.
>
> On Thu, Nov 20, 2025, 5:27 PM Александр Поваляев via Gcc-help <
> gcc-help@gcc.gnu.org> wrote:
>
> > struct zzz {
> > unsigned x, y;
> > };
> >
> > void square(struct zzz ** arr_of_ptr, unsigned count) {
> >
> > *// The first "const" produce an error (not a warning) within some GCC
> > toolchains, for example ARM GCC trunk (linux), see goldbolt.org
> > <http://goldbolt.org>*
> > struct zzz const * const * const end_of_arr = arr_of_ptr + count;
> >
> > *// Without the first const "struct zzz * const * const end_of_arr =
> > arr_of_ptr + count;" it works fine!!!*
> >
> > }
> >
> > Respectfully,
> > Aleksandr G Povaliaev.
> >


More information about the Gcc-help mailing list