Date: Mon, 9 Feb 2026 12:23:03 +0000
On Sun, Feb 8, 2026 at 12:06 PM Jens Maurer wrote:
>
> > (2) Not too much hassle for compiler writers
> > (3) Not too much complication for standards writers
>
> Not among the primary goals of a proposal.
I think these two are the primary reason why no progress has been made
on NRVO in C++.
> > I think the happy medium is to mark the return slot as follows:
> >
> > mutex Func(void)
> > {
> > [[nrvo]] mutex m;
> > m.lock();
> > return m;
> > }
>
> [... rules omitted ...]
>
> How does this use of an attribute fit the idea that attributes
> have optional semantics, given that the program will be ill-formed
> without the attribute present?
Maybe use there brackets for cannot-be-ignored attributes, e.g.
[[[nrvo]]] [[[nouniqueaddress]]]
>
> > (2) Not too much hassle for compiler writers
> > (3) Not too much complication for standards writers
>
> Not among the primary goals of a proposal.
I think these two are the primary reason why no progress has been made
on NRVO in C++.
> > I think the happy medium is to mark the return slot as follows:
> >
> > mutex Func(void)
> > {
> > [[nrvo]] mutex m;
> > m.lock();
> > return m;
> > }
>
> [... rules omitted ...]
>
> How does this use of an attribute fit the idea that attributes
> have optional semantics, given that the program will be ill-formed
> without the attribute present?
Maybe use there brackets for cannot-be-ignored attributes, e.g.
[[[nrvo]]] [[[nouniqueaddress]]]
Received on 2026-02-09 12:23:15
