https://issues.dlang.org/show_bug.cgi?id=23264
Issue ID: 23264
Summary: Allow __traits(parameters) in the return type or
contract of a function
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
Allow __traits(parameters) to occur in any part of the function, not only its
body and `in` and `out` contract.
The following should be legal:
typeof(__traits(parameters))[0] f(Ts...)(Ts args) { … }
void f(Ts...)(Ts args)
if (__traits(parameters).length > 1)
{ … }
But they are rejected with
Error: `__traits(parameters)` may only be used inside a function
It is unmistakably clear what the intention is.
--