Skip to content

Missing warning for bool conversion from pointer #68401

@mkbosmans

Description

@mkbosmans

When compiling the code

#include<stdbool.h>

void getBool(bool out);
void getInt(int out);

void test(bool *b, int* i);
void test(bool *b, int* i) {
  getBool(b);
  getInt(i);
}

with clang -std=c99 -Weverything -c bool_pointer_warning.c, I get a warning about the pointer argument of getInt, but not about the pointer argument of getBool.

I guess that is because a pointer is implicitly converted to a boolean, but it would be nice to be able to ask to be warned about the forgotten pointer dereference here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions