> 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?)