getOverloads __traits does not seem to include instances of the generic members

user1234 user1234 at 12.de
Mon Mar 2 10:53:30 UTC 2026


I find this a bit odd

```d
enum IncludeTemplate = true;

///

void v0(T)(T t){}
void v0(){}
void v0(int){}

static assert(__traits(getOverloads, mixin(__MODULE__), "v0", 
IncludeTemplate).length == 3);

///

void v1(T)(T t){}
void v1(){}
alias v1_OfInt = v1!int;

static assert(__traits(getOverloads, mixin(__MODULE__), "v1", 
IncludeTemplate).length == 3); // fails
```

The problem is that you cannot add a member using an alias with 
the same name

```d
void v2(T)(T t){}
void v2(){}
alias v2 = v2!int;

static assert(__traits(getOverloads, mixin(__MODULE__), "v2", 
IncludeTemplate).length == 3);
```

> Error: template instance `v2!int` `v2!int` forward references 
> template declaration `v2(T)(T t)`

I see a problem here, what do you think ?


More information about the Digitalmars-d mailing list