C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Similar to [[no_discard]], but store in a variable, maybe call it [[must_store]]

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Tue, 22 Jul 2025 16:27:24 +0100
On Tue, Jul 22, 2025 at 4:23 PM Frederick Virchanza Gotham wrote:
>
> "When applied to a class's method, the [[lifetimebound]] attribute
> indicates that the invocation of the method on an object of the class
> will return a value which is only valid for the lifetime of the
> aforementioned object. Therefore where possible, the compiler shall
> issue a diagnostic if it detects the use of the return value after the
> aforementioned object has been destroyed."


And even if compiler vendors say it's too much grief to implement . .
. maybe it will make it into 'cppcheck'

Received on 2025-07-22 15:27:37