This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
inconsistent behavior with string literals and char*
- To: gcc-bugs at gcc dot gnu dot org
- Subject: inconsistent behavior with string literals and char*
- From: Corey Kosak <kosak at cs dot cmu dot edu>
- Date: Mon, 18 Oct 1999 02:35:48 -0400
Surely lines 7 and 8 should either both be legal, or both illegal.
% cat qwe.cc && g++ -v && g++ qwe.cc
const int x=0;
int y;
int main()
{
char *p="moo";
char *q= x>1 ? "moo" : "cow"; //line 7
char *r= y>1 ? "moo" : "cow"; //line 8
return 0;
}
Reading specs from /usr/local/libexec/gcc-19991013/lib/gcc-lib/i686-pc-linux-gnu/2.96/specs
gcc version 2.96 19991013 (experimental)
qwe.cc: In function `int main ()':
qwe.cc:8: cannot convert `const char *' to `char *' in initialization
%