Bug 18438 – hasStaticMember fails with a T* while hasMember passes
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2018-02-14T23:35:40Z
Last change time
2018-03-29T23:53:05Z
Assigned to
No Owner
Creator
Ali Ak
Comments
Comment #0 by ali.akhtarzada — 2018-02-14T23:35:40Z
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 fail.
This fixes the latter if desired, and I'm happy to push a PR and fix as needed if this is the correct direction:
https://github.com/aliak00/phobos/commit/3d5b9677944acb7439dd1564fac899400b00de32
(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.)
Comment #1 by github-bugzilla — 2018-03-29T23:53:04Z