[Issue 16390] __traits not accepted where a type is expected

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Aug 15 10:26:24 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16390

--- Comment #2 from Lodovico Giaretta <lodovico at giaretart.net> ---
(In reply to b2.temp from comment #1)
> This is really common to use typeof() on the result of a __traits()
> 
> template ParentType(T)
> {
>     alias ParentType = typeof(__traits(parent, T));
> }

If this was meant to be a workaround, it doesn't seem to work for me (the trait
returns a type, while typeof expects an expression).

If it was meant to be another situation where __traits should be allowed but
are not, it looks like they are currently allowed inside typeof.

--


More information about the Digitalmars-d-bugs mailing list