[Issue 14964] New: __traits(isAlias, foo)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Aug 26 05:49:36 PDT 2015


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

          Issue ID: 14964
           Summary: __traits(isAlias, foo)
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: aldacron at gmail.com

Currently, there doesn't appear any way to distinguish traits tested on an
alias and the symbol it aliases.

```
module funcs;
alias FuncPtr = void function();
@ChooseMe FuncPtr funcPtr;
alias anotherName = funcPtr;

module foo;
foreach(sym; __traits(getAllMembers, funcs))
   // Call hasUDA, isFunctionPtr, etc...

```
Here, I want to single out funcPtr, but it's impossible as any test that is
true for funcPtr is also true for anotherName. An isAlias trait would be quite
helpful for this situation.

--


More information about the Digitalmars-d-bugs mailing list