A variable is initialized with its own value, which is indeterminate at that point
What it finds
int count = count; or, in a constructor, Buffer(int n) : size_(size_) {}: a variable's scope starts at its declarator, so the initializer reads the new variable, whose value is still indeterminate, and not one of the same name further out. In the initializer list of a constructor a name that no parameter declares is the member itself, so the member is initialized from its own indeterminate value; usually a parameter was meant.
For a member, the initializer must be the member's name alone, and no parameter, local or other name of the file may be declared with it, so that it can only be the member.
From the rule's source, self_initialization.rs.
Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/cpp:self-initialization" = "warning"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:self-initialization] reason="..."tx0 explain tx0/cpp:self-initialization shows the same in the terminal. Found a false positive? Report it.