This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

inconsistent error reporting in g++


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]