It's useful to identify at compile time types with 0 initializers. Doing this with CTFE and templates is slow and memory-hungry[1] and runs into errors[2][3]. The compiler already has its own check for this that we can expose instead. Proposed syntax is `__traits(isZeroInit, T)` where the second argument must resolve to the type T itself instead of being any expression whose result is an instance of T. This would be to prevent someone from mistakenly thinking he can use `__traits(isInitZero, x)` to test whether some variable `x` was explicitly initialized as zero. [1] https://github.com/dlang/phobos/pull/6537 [2] https://github.com/dlang/phobos/pull/6670#issuecomment-414111649 [3] https://github.com/dlang/phobos/pull/6461
Pull request: https://github.com/dlang/dmd/pull/8583
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/6983b0b071f8cb495639f62382e8658ddde03d77 Fix Issue 19180 - Expose dmd.mtype.Type.isZeroInit as __traits(isZeroInit, T) https://github.com/dlang/dmd/commit/6d067b0084cfffb7c76c936b8af335373b565adf Merge pull request #8583 from n8sh/isZeroInit-19180 Fix Issue 19180 - Expose dmd.mtype.Type.isZeroInit as __traits(isZeroInit, T) merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
Commits pushed to master at https://github.com/dlang/dlang.org https://github.com/dlang/dlang.org/commit/5183de7809b7d5367e0b444f0c423f77e6e97a67 Update spec for Issue 19180 - Expose... __traits(isZeroInit, T) This is the companion of https://github.com/dlang/dmd/pull/8583 https://github.com/dlang/dlang.org/commit/826ea94809d870328bd98d9aeac2472b657d0c49 Merge pull request #2450 from n8sh/isZeroInit-19180 Update spec for Issue 19180 - Expose... __traits(isZeroInit, T) merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
dlang/dmd pull request #12093 "[dmd-cxx] Backport more recent traits to the C++ port" was merged into dmd-cxx: - c480509b0f455c8dc86c70752d55e517ca3d7416 by Nathan Sashihara: [dmd-cxx] Fix Issue 19180 - Expose dmd.mtype.Type.isZeroInit as __traits(isZeroInit, T) https://github.com/dlang/dmd/pull/12093