Skip to content

[clang-tidy] extend readability-redundant-member-init to non-static data member initializers #62525

Closed
@chrchr-github

Description

@chrchr-github
#include <vector>
struct S {
    S() : x() {}
    std::vector<int> v{};
    std::vector<int> w = {};
    std::vector<int> x;
};
<[source>:3:11: warning: initializer for member 'x' is redundant [readability-redundant-member-init]
    S() : x() {}
          ^~~~

It would be nice to get warnings also for v and w.
https://godbolt.org/z/P9KaeW485

Metadata

Metadata

Assignees

Labels

awaiting-reviewHas pending Phabricator reviewclang-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