Template alias parameter: error: need 'this' for ...

Elfstone elfstone at yeah.net
Sat Feb 25 03:59:38 UTC 2023


On Friday, 24 February 2023 at 15:28:18 UTC, Steven Schveighoffer 
wrote:
> On 2/24/23 7:00 AM, Elfstone wrote:
>> 
>> Seems like the same bug is still there after ten years.
>> 
>
> `static` should not affect module-level functions, but also, 
> this code should work without `static`.
>
> Reported, not sure if there's a previous bug, it was hard to 
> come up with a good description:
>
> https://issues.dlang.org/show_bug.cgi?id=23738
>
> -Steve

It was marked duplicate. I read the comments to the previous 
issue and felt like reading C++ discussions, except C++ is a lot 
better documented.

Anyway surely `__traits(getAttributes, Bar.t)` compiles. The 
compiler should "need 'this'" when it actually need 'this' - 
unless there are attributes that can be bound to 'this'.



More information about the Digitalmars-d-learn mailing list