inconsistent error reporting in g++
Igor Sheyn
sheyn@cs.bu.edu
Tue Jun 13 15:46:00 GMT 2000
Hi,
consider the following 2 programs:
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
int ff(int x)
{
char *s = (2>1)? "a": "b";
}
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
int ff(int x)
{
char *s = (x>1)? "a": "b";
}
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
g++ 2.96 compiles the first one fine, but when compiling the 2nd one, gives
the following error:
xyu.c: In function `int ff (int)':
xyu.c:3: cannot convert `const char *' to `char *' in initialization
I can understand this cast-related error, but how come g++ lets it go
unreported in the 1st case?
Thanks
Igor
More information about the Gcc-bugs
mailing list