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?

Reply via email to