This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[RFC] warning: initialization discards qualifiers from pointertarget type
- From: Paul Schlie <schlie at comcast dot net>
- To: Devang Patel <dpatel at apple dot com>,<gcc at gcc dot gnu dot org>
- Date: Sun, 17 Apr 2005 13:48:30 -0400
- Subject: [RFC] warning: initialization discards qualifiers from pointertarget type
> warning: initialization discards qualifiers from pointer target type
>
> This warning can not be disabled using -Wno-cast-qual
> (or any other warning flags). Is it intentional ?
> Otherwise I'll prepare patch.
>
> const char *a( void )
> {
> return "abc";
> }
>
> int main( void )
> {
> char *s = a();
> return 0;
> }
Actually I'd like to think this is enforced as an "illegal" assignment.
(as it seem wrong to "discard pointer qualifiers" unless the assignment
actually "copies" the literal string, which I don't believe it does;
as any attempt to write to a const string literal should not be valid?)