C++ Logo

std-discussion

Advanced search

Re: Question on P1306: Expansion Statements

From: Liu Yanzuo <zwuis_at_[hidden]>
Date: Mon, 12 Jan 2026 13:41:58 +0000
On Mon, 12 Jan 2026 09:14, Jens Maurer via Std-Discussion wrote:

> This is not in the wording section of the paper.
> The wording section is what contains the changes to the standard's Working Draft.
>
> Do you have an example that isn't treated properly by the current wording?
>
> Jens
>
>
>
> On 1/12/26 04:44, Liu Yanzuo via Std-Discussion 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?
> >
> > Thanks,
> > Yanzuo Liu

I understand. I want to confirm that someone noted the difference and there was a discussion about the difference.

Example:
```cpp
template <typename T>
void i_want_to_forward_elements(T&& arg) {
    template for (auto&& elem : std::forward<T>(arg)) {
        // According to the logic I referenced, elem is lvalue reference or rvalue reference
        //
        // Proposed wording in P1306R5 (in [stmt.expand]/5.3 currently):
        // for-range-declaration = ui;
        // elem is always lvalue reference
        use(std::forward<decltype(elem)>(elem));
    }
}
```

Received on 2026-01-12 13:42:06