[Bug c++/25845] want optional warning for non-constant declarations that could be constant

Andrew Pinski pinskia@physics.uc.edu
Wed Jan 18 19:33:00 GMT 2006


> > int f(const int *a, int *b)
> > {
> >    *b = 1;
> >    return *a;
> > }
> > 
> > a and b can alias and there is no way around that at all because that is
> > what the C++ standard says.
> 
> In this case the compiler should warn because a could be declared "const int *
> const" and b could be declared "int * const".

That still does not change the fact that a could point to the same location as
b is pointing too.

-- Pinski



More information about the Gcc-bugs mailing list