------- Comment #2 from anton dot kirillov at rd-software dot com 2006-01-27 13:12 ------- (In reply to comment #1) > earth:~>g++ t.cc -pedantic -Wwrite-strings > t.cc: In function int main(): > t.cc:5: warning: deprecated conversion from string constant to char*' >
Conversion from string constant to char*' it's legacy from C, but GCC should not perceive it as const char*, because the type of expression is const char[]! I think GCC have defined it as a compile-time constant, but it's infeasible solution. In other situation it behaves correctly: void foo( char* ); int main() { bool flag = false; foo( flag ? "a" : "b" ); // error ( cannot convert from const char* to char* ) } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25992