This needs to be fixed - ref
Nick Treleaven
nick at geany.org
Sat Aug 31 09:23:48 UTC 2024
On Saturday, 31 August 2024 at 06:45:00 UTC, Timon Gehr wrote:
> On 8/28/24 17:19, Nick Treleaven wrote:
>>> It's astonishing that s.tupleof is a sequence of ref's as you
>>> say...
>>
>> BTW that was just how I understand `.tupleof`. I see it as (a
>> superset of) a sequence of implicit ref declarations.
>
> Well, but that is not what it is.
>
> ```d
> alias Seq(T...)=T;
>
> struct S{
> int x;
> alias expand=Seq!x;
> }
>
> void main(){
> S s;
> pragma(msg,__traits(isRef,s.tupleof[0])); // false
> pragma(msg,__traits(isSame,s.expand,s.tupleof)); // true
> }
>
> ```
OK, thanks. And `s.expand[0].writeln();` works too.
So the following error makes sense:
alias x = s.expand[0];
x.writeln(); // Error: accessing non-static variable `x`
requires an instance of `S`
More information about the Digitalmars-d
mailing list