llvm-project
90a95524 - [clang-tidy] Ignore 0 and NULL null pointers in modernize-use-emplace (#237770)

Commit
10 days ago
[clang-tidy] Ignore 0 and NULL null pointers in modernize-use-emplace (#237770) The check rewrites ``` v.push_back(T(42, 0)); ``` where the second parameter of the constructor of `T` is a pointer, to `v.emplace_back(42, 0)`. The forwarding reference of `emplace_back` deduces `0` as an `int`, which, unlike the literal, does not convert to a pointer, so the rewritten call does not compile. `NULL`, which is `__null` or an integer literal, has the same problem, as does a literal zero passed for a pointer to member. Ignore such calls, as the check already does for bit-field arguments, and remove the FIXME about them. `nullptr` is deduced as `std::nullptr_t`, which converts to any pointer, so calls passing it are still reported. Assisted-by: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Author
Parents
Loading