Say I have
[[nodiscard]] int foo () { return 0; } int main () { foo (); }
then
error: ignoring return value of ‘in
You can also tag the returned int with another tag:
int
[[nodiscard]] int foo () { return 0; } int main () { [[maybe_unused]] int i = foo (); }
Could be useful if you have some debug-only code that requires the value.