Re: A: a new bug to old plain C

Jonathan Wakely via Gcc-help <[email protected]>
Newsgroups gmane.comp.gcc.help
Message-ID <CAH6eHdTDbTMgu__cS-uFtMJn7SRTh1wzxTuM5=1ZyanJXONRiA@mail.gmail.com>
On Fri, 21 Nov 2025 at 03:25, Chris S via Gcc-help <[email protected]> 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 <
> [email protected]> 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.
> >
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.