[clang-tools-extra] [clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… (PR #65231)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 3 11:41:09 PDT 2023


Carlos =?utf-8?q?Gálvez?= <carlos.galvez at zenseact.com>


https://github.com/PiotrZSL commented:

Maybe:

```
Identifies unimplemented private special member functions, recommends using '= delete' for them, and suggests relocating such deleted functions from the private to the public section.

Before the introduction of C++11, the primary method to effectively "erase" a particular function involved declaring it as private without providing a definition. This approach would result in either a compiler error (when attempting to call a private function) or a linker error (due to an undefined reference).

However, subsequent to the advent of C++11, a more conventional approach emerged for achieving this purpose. It involves flagging functions as "= delete" and retaining them within the public section of the code.

To prevent false positives, this check is only applicable within a translation unit where all other member functions have been implemented. The check will generate partial fixes by introducing "= delete," but the user is responsible for manually relocating it to the public section.
```

https://github.com/llvm/llvm-project/pull/65231


More information about the cfe-commits mailing list