Diagnoses when a non-trivial type is not assigned to a variable. This is useful to check for problems like unnamed lock guards.
For example, if you had code written like this:
int g_i = 0; std::mutex g_i_mutex; // protects g_i void safe_increment() { std::lock_guard<std::mutex>{g_i_mutex}; // The lock is locked and then unlocked before reaching here ++g_i; }
This will warn that a variable should be created instead:
int g_i = 0; std::mutex g_i_mutex; // protects g_i void safe_increment() { std::lock_guard<std::mutex> lock{g_i_mutex}; // The lock is locked and then will be unlocked when exiting scope ++g_i; }