This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug with assignment to const * in C (but not in C++)


Alexandre Oliva:
> On Feb  1, 1999, John Ruttenberg <rutt@tensilica.com> wrote:
> 
> > This compiles without warning by g++ but gcc warns:
> 
> >     y.c: In function `x':
> >     y.c:7: warning: assignment from incompatible pointer type
> 
> > I thought that assignment to greater constness was always allowed.
> 
> Not always, see http://reality.sgi.com/austern/std-c++/faq.html#C1
> 
> > Are the rules different for ANSI C then for C++?
> 
> I'm no C language lawyer, but the code looks like valid C++ for me.

I don't get it.  Matt's web page seems to say this is incorrect.  Yet g++
accepts it.  Is this a bug with g++, then?  gcc does warn.  So perhaps it is
correct?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]