Skip to content

[clang-tidy] readability-container-size-empty fails to detect calls to member functions #152649

@vbvictor

Description

@vbvictor

Given code:

void bar();

class foo {
  int size() const;
  bool empty() const;

  void doit() {
    if (!size())
      bar();
  }
};

Should warn to use empty() instead of !size() but it doesn't.
https://godbolt.org/z/feGTc8vPo

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-tidyenhancementImproving 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