The vulnerability as documented in ISO/IEC 24772-1 clause 6.19 exists in C++.
A common practice for resource management in C++ relies on what is called “RAII” or “SBRM” (scope-based resource management): employing a class’ destructor to release resources managed by the object. This can lead to code without visible use of a variable being present in the source code, because all work is done by the variable’s constructor and/or destructor.
To avoid the vulnerability or mitigate its ill effects, C++ software developers can:
Use the avoidance mechanisms of ISO/IEC 24772-1 clause 6.19.5.
Use compiler warnings and/or static analysis tools to indicate and eliminate unused variables.