Say I have
[[nodiscard]] int foo () { return 0; } int main () { foo (); }
then
error: ignoring return value of ‘in
Cast it to void:
[[nodiscard]] int foo () { return 0; } int main () { static_cast(foo()); }
This basically tells the compiler "Yes I know I'm discarding this, yes I'm sure of it."