Date: Wed, 14 Jan 2026 14:57:00 +0000
On Wednesday, January 14, 2026, Ville Voutilainen wrote:
>
> So what if it does? If your function returns an rvalue reference or it
> returns a decltype(auto), that just works,
> and if your function returns a prvalue, that also works without the
> cast, the returned value is subject to auto-elision
> and auto-move.
>
The following source file fails to compile:
extern int &&CalleeFunction(void);
int &&EnclosingFunction(void)
{
decltype(auto) x = CalleeFunction();
if ( x ) return x;
}
>
> So what if it does? If your function returns an rvalue reference or it
> returns a decltype(auto), that just works,
> and if your function returns a prvalue, that also works without the
> cast, the returned value is subject to auto-elision
> and auto-move.
>
The following source file fails to compile:
extern int &&CalleeFunction(void);
int &&EnclosingFunction(void)
{
decltype(auto) x = CalleeFunction();
if ( x ) return x;
}
Received on 2026-01-14 14:57:02
