You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<functional>struct [[nodiscard]] A {};
A f();
std::function<void ()> ff(f);
voidg() {
ff();
}
std::function calls f() (or rather, a function pointer that that returns an A), but returns void. So somewhere, something should complain about the nodiscard A being discarded. But it looks like it's explicitly silenced somewhere, causing hard-to-find bugs.
Investigation by the gcc team [1] revealed it's likely due to -Wunused-result being suppressed in system headers, which it probably should not be.