C++ Logo

std-proposals

Advanced search

Re: [std-proposals] return if

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 14 Jan 2026 17:32:13 +0200
On Wed, 14 Jan 2026 at 17:30, Thiago Macieira via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> On Wednesday, 14 January 2026 06:57:00 Pacific Standard Time Frederick
> Virchanza Gotham via Std-Proposals wrote:
> > extern int &&CalleeFunction(void);
> >
> > int &&EnclosingFunction(void)
> > {
> > decltype(auto) x = CalleeFunction();
> > if ( x ) return x;
> > }
>
> Compiles with GCC and Clang, albeit with a warning that it reaches the end of
> a non-void function without a return. The old ICC (with the EDG front-end) and
> MSVC don't like it:
>
> https://gcc.godbolt.org/z/WcoEb8ehM

At any rate, that has nothing to do with value categories and how
decltype(auto) works, and changes exactly
nothing in how the "return if" is just an unnecessary dead duck that
doesn't even simplify anything.

Received on 2026-01-14 15:32:30