I agree with what you said.

 

But for suppressing a warning and not prolonging the lifetime one could put a scope around it.

 

{

    auto discard = f();

}
 

 

It does, what it should. Is it short? Is it pretty? Not sure.

 

-----Ursprüngliche Nachricht-----
Von: Jan Schultke via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Di 22.07.2025 14:38
Betreff: Re: [std-proposals] Similar to [[no_discard]], but store in a variable, maybe call it [[must_store]]

There's also a question of how to suppress a warning produced by
[[must_store]].