Bug 19236 – Replace runtime `typeid(T).initializer().ptr is null` checks with compile-time `__traits(isZeroInit, T)`

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-09-09T16:08:01Z
Last change time
2018-09-09T17:14:49Z
Assigned to
No Owner
Creator
Nathan S.

Comments

Comment #0 by n8sh.secondary — 2018-09-09T16:08:01Z
With the new `__traits(isZeroInit)` (https://github.com/dlang/dmd/pull/8583) we can check at compile-time if a type has a zero initializer. Aside from removing a branch and some dead code, removing a use of `TypeInfo` is a step towards -betterC compatibility.
Comment #1 by github-bugzilla — 2018-09-09T17:14:48Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/947ba5170713234eb29305ce44136e067728d389 Fix Issue 19236 - Replace runtime `typeid(T).initializer().ptr is null` checks with compile-time `__traits(isZeroInit, T)` https://github.com/dlang/phobos/commit/538587451b0d7a284d90b62d54b448cc9e92d689 Merge pull request #6698 from n8sh/issue-19236 Fix Issue 19236 - Replace runtime `typeid(T).initializer().ptr is null` checks with compile-time `__traits(isZeroInit, T)`