__traits(parent) bug?

Jack Applegame japplegame at gmail.com
Fri Oct 23 14:12:59 UTC 2020


> struct Foo {
>    struct Bar(T) {
>        T x;
>    }
> }

I expect the value of `__traits(parent, Foo.Bar!int)` is `Foo`, 
but it is `Foo.Bar!int`.

Yes, it looks like the type is the parent of itself. :-)

I know that `Foo.Bar!int` is internally `Foo.Bar!int.Bar`, but I 
believe this behavior of `__traits(parent)` is wrong.

Also consider, please, another question - 
https://forum.dlang.org/thread/oyysbwgkycbmwuoifkky@forum.dlang.org



More information about the Digitalmars-d mailing list