cpp/language/attributes/nodiscard

If a function declared or a function returning an enumeration or class declared  by value is called from a discarded-value expression other than a cast to, the compiler is encouraged to issue a warning.

Explanation
Appears in a function declaration, enumeration declaration, or class declaration.

If, from a discarded-value expression other than a cast to ,


 * a function declared is called, or
 * a function returning an enumeration or class declared by value is called, or
 * a constructor declared is called by explicit type conversion or, or
 * an object of an enumeration or class type declared is initialized by explicit type conversion or ,

the compiler is encouraged to issue a warning.

Standard library
The following standard functions are declared with attribute: