[Bug c++/86228] New: ordered comparison between pointer and zero
zhonghao at pku dot org.cn
gcc-bugzilla@gcc.gnu.org
Wed Jun 20 03:01:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86228
Bug ID: 86228
Summary: ordered comparison between pointer and zero
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: zhonghao at pku dot org.cn
Target Milestone: ---
The code is as follow:
extern void* p;
int main() { return ( p<0 ? 1 : 0 ); }
clang++ rejects it with an error message:
error: ordered comparison between pointer and zero ('void *' and 'int')
int main() { return ( p<0 ? 1 : 0 ); }
However, g++ accepts it without any warnings.
Is this code ill-formed?
More information about the Gcc-bugs
mailing list