Код: Выделить всё
[[nodiscard]] int foo ()
{
return 0;
}
int main ()
{
foo ();
}
Код: Выделить всё
error: ignoring return value of ‘int foo()’, declared with attribute nodiscard [-Werror=unused-result]
Код: Выделить всё
int x = foo ();
Код: Выделить всё
error: unused variable ‘x’ [-Werror=unused-variable]
Подробнее здесь: https://stackoverflow.com/questions/535 ... turn-value