C++ Logo

std-discussion

Advanced search

Re: Question on P1306: Expansion Statements

From: Liu Yanzuo <zwuis_at_[hidden]>
Date: Mon, 12 Jan 2026 12:56:45 +0000
On Mon, 12 Jan 2026 10:01, Ville Voutilainen via Std-Discussion wrote:
> On Mon, 12 Jan 2026 at 05:44, Liu Yanzuo via Std-Discussion <std-discussion_at_[hidden]> wrote:
> >
> > Hi,
> >
> > I noted that, in [P1306R5 3.3 Expansion over Tuples](https://wg21.link/p1306r5#expansion-over-tuples):
> >
> > > get-expr(i) is __vi if either the referenced type is an lvalue reference or the expansion-initializer is an lvalue. Otherwise, std::move(__vi).
> >
> > This logic doesn't appear in the proposed wording. Was it forgotten?
>
> It does appear there, because that logic is what structured bindings
> end up doing. We end up going to
> [dcl.struct.bind]/7, the sub-paragraph in the middle:
> "In either case, e is an lvalue if the type of the entity e is an
> lvalue reference and an xvalue otherwise. Given
> the type Ti designated by std::tuple_element<i, E>::type and the type
> Ui designated by either Ti & or
> Ti&&, where Ui is an lvalue reference if the initializer is an lvalue
> and an rvalue reference otherwise".

[dcl.struct.bind]/7 is unrelated. It describes the initializer of underlying variable of structured binding.

The paragraph I referenced describes the initializer of for-range-declaration of expansion statements.
__vi is the name of structured binding. It is always lvalue.

You can see https://wg21.link/p1306r5#pnum_33

Received on 2026-01-12 12:56:50