Issue 132260
Summary [clang-tidy] False positive for modernize-avoid-c-arrays in smart pointers and their make functions
Labels clang-tidy
Assignees
Reporter kuzi117
    Clangd version: 19.1.2

Using the `T[]` specialization for `make_unique`/`make_unique_for_overwrite` and the resulting unique_ptr, clang-tidy reports that the template parameter should be replaced with `std::array`.

Example:
```
  std::unique_ptr<T[]> W = std::make_unique<T[]>(n);
  std::unique_ptr<T[]> X = std::make_unique_for_overwrite<T[]>(n);
  std::shared_ptr<T[]> Y = std::make_shared<T[]>(n);
  std::shared_ptr<T[]> Z = std::make_shared_for_overwrite<T[]>(n);
```
Every instance of `T[]` in the example is flagged as violating cppcoreguidelines-avoid-c-arrays/modernize-avoid-c-arrays and suggests using `std::array instead`, which doesn't seem feasible in the context.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to