[Issue 19180] Expose dmd.mtype.Type.isZeroInit as __traits(isZeroInit, T)
https://issues.dlang.org/show_bug.cgi?id=19180 --- Comment #1 from Nathan S. --- Pull request: https://github.com/dlang/dmd/pull/8583 --
[Issue 19180] New: Expose dmd.mtype.Type.isZeroInit as __traits(isZeroInit, T)
https://issues.dlang.org/show_bug.cgi?id=19180 Issue ID: 19180 Summary: Expose dmd.mtype.Type.isZeroInit as __traits(isZeroInit, T) Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: n8sh.second...@hotmail.com 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 --
[Issue 18838] Formatting the number zero with separator doesn't obey width specifier
https://issues.dlang.org/show_bug.cgi?id=18838 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/6b6d5c15c09327e882f1a72c171fa4674d50dfc4 fix issue 18838 - Formatting the number zero with separator doesn't obey width specifier https://github.com/dlang/phobos/commit/a86b12303b741dc2f1f87cc29f6ea695a0635875 Merge pull request #6673 from BBasile/issue-18838 fix issue 18838 - Formatting the number zero with separator doesn't obey width specifier merged-on-behalf-of: Nathan Sashihara --
[Issue 19179] extern(C++) small-struct by-val uses wrong ABI
https://issues.dlang.org/show_bug.cgi?id=19179 Manu changed: What|Removed |Added Keywords||C++, industry, wrong-code --- Comment #1 from Manu --- Oops, my cut removed the `extern(C++):` at the top of the D source. Those 2 test functions should be extern(C++)! --
[Issue 19179] New: extern(C++) small-struct by-val uses wrong ABI
https://issues.dlang.org/show_bug.cgi?id=19179 Issue ID: 19179 Summary: extern(C++) small-struct by-val uses wrong ABI Product: D Version: D2 Hardware: All OS: Windows Status: NEW Severity: blocker Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: turkey...@gmail.com test.d -- import core.stdc.stdio; extern(C++) struct SmallStruct { int x = 10, y = 20; } SmallStruct test_small(SmallStruct s) { printf("%d %d\n", s.x, s.y); // prints: invalid memory return s; } void test_small_noret(SmallStruct s) { printf("%d %d\n", s.x, s.y); // prints: 10 20 } test.cpp struct SmallStruct { int x = 10, y = 20; }; SmallStruct test_small(SmallStruct); void test_small_noret(SmallStruct); void main() { test_small(SmallStruct()); test_small_noret(SmallStruct()); } Tested with VS2015 - x86 and x64 Note: if you add one more `int` to the struct, this code works as expected. --
[Issue 18838] Formatting the number zero with separator doesn't obey width specifier
https://issues.dlang.org/show_bug.cgi?id=18838 Basile B. changed: What|Removed |Added Keywords||pull --- Comment #1 from Basile B. --- pull : https://github.com/dlang/phobos/pull/6673 --
[Issue 18838] Formatting the number zero with separator doesn't obey width specifier
https://issues.dlang.org/show_bug.cgi?id=18838 Basile B. changed: What|Removed |Added CC||b2.t...@gmx.com Hardware|x86_64 |All OS|Windows |All --
[Issue 19178] New: Static initialization of 2d static arrays in structs produces garbage or doesn't compile sometimes
https://issues.dlang.org/show_bug.cgi?id=19178 Issue ID: 19178 Summary: Static initialization of 2d static arrays in structs produces garbage or doesn't compile sometimes Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: dkor...@live.nl Doing this: ``` struct T { int[3][3] arr = 2; } ``` Results in: cannot implicitly convert expression 2 of type int to int[3][3] While it's okay to do this in a function body. Furthermore: ``` import std.stdio: writeln; struct T { int[3][3] arr = [2, 1]; this(int stub) { arr[0][0] = 9; } } void main() { T.init.writeln; T(0).writeln; } ``` Outputs this: ``` T([[2, 1, 0], [0, 0, 118033674], [723976, 0, 4100]]) T([[9, 2, 2], [1, 1, 1], [0, 0, 0]]) ``` The .init value is incorrect and has garbage. Related: https://issues.dlang.org/show_bug.cgi?id=13799 "Whole-array initialization for static fixed-size arrays of arrays too" --