std::auto_ptr is used, whose copies silently transfer ownership and which C++17 removed

tx0/cpp:auto-ptrdefaultwarningreliability/memory-safetydepth fastbug

What it finds

Copying a std::auto_ptr moves the pointer out of the source and leaves it null, which containers and algorithms do not expect. It was deprecated in C++11 and removed in C++17; std::unique_ptr has the same purpose with explicit moves.

From the rule's source, auto_ptr.rs.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/cpp:auto-ptr" = "off"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/cpp:auto-ptr] reason="..."

tx0 explain tx0/cpp:auto-ptr shows the same in the terminal. Found a false positive? Report it.