[Bug c++/124935] [doc][diagnostics] undocumented warnings for -Wextra

heiko at hexco dot de gcc-bugzilla@gcc.gnu.org
Tue Apr 21 20:50:17 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124935

--- Comment #3 from Heiko Eißfeldt <heiko at hexco dot de> ---
updated to include an nullptr_t pointer:
https://godbolt.org/z/drEjGoWYK
```C
#include <stddef.h>
int main(void)
{
    void *v;
    char *c;
    nullptr_t *n;
    if (c < (char *)0) /* no warning with -Wextra why? */
    if (c < (char *)nullptr) /* no warning with -Wextra why? */
    if (c < nullptr) /* ordered comparison of pointer with integer zero? */
    if (v < nullptr) /* ordered comparison of pointer with integer zero? */
    if (n < nullptr) /* ordered comparison of pointer with integer zero? */
    return v < (void *)0;  /* ordered comparison of pointer with null pointer
*/
}
```
The only type that is considered for a null pointer seems to be void *.


More information about the Gcc-bugs mailing list