www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18438] New: hasStaticMember fails with a T* while hasMember


          Issue ID: 18438
           Summary: hasStaticMember fails with a T* while hasMember passes
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: ali.akhtarzada gmail.com

Seems __traits(hasMember, T*, m) is resolved amicably by the compiler and it
tells you if m is a member of T or not. OTOH, hasStaticMember barfs with a
compiler error if you give it a T*. Due to the implementation of
hasStaticMember, compilation only fails with member fields, not functions.

Error: cannot interpret T* at compile time

IMO, hasMember and hasStaticMember should either both fail on a T* or both not

This fixes the latter if desired, and I'm happy to push a PR and fix as needed
if this is the correct direction:


(There was a bug in the unittest which I fixed in the same commit as well. If
this is not ok, I'm happy to alter as required.)

Feb 14 2018