www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14964] New: __traits(isAlias, foo)


          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 puremagic.com
          Reporter: aldacron 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.

Aug 26 2015