C++ Logo

std-proposals

Advanced search

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

From: Aurelien Cassagnes <aurelien.cassagnes_at_[hidden]>
Date: Wed, 23 Jul 2025 06:37:21 +0900
https://clang.llvm.org/docs/AttributeReference.html#lifetimebound


Sent from Gmail Mobile


On Wed, Jul 23, 2025 at 0:27 Frederick Virchanza Gotham via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> 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'
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2025-07-22 21:37:38