llvm-project
llvm-project copied to clipboard
[clang-tidy][request] Flag use of empty init list in function call
Readibility can be improved by specifying the type or using a literal. Maybe there could be an option to only consider fundamental types.
#include <vector>
void f(const std::vector<int>& v, bool b, int i, double d);
void g() {
f({}, {}, {}, {});
f(std::vector<int>(), false, 0, 0.0);
}
https://godbolt.org/z/Pfo3YYWGc
for built-in types, i like it.... For non-trivial types, there could be an option.
For both fundamental types and user-defined types in the empty initializer list, the behavior and interpretation depend on type's constructor or initialization rules.
can I work on this?