Severe 2.084 regression when using staticArray on array of struct with class and bool member

John Colvin john.loughran.colvin at gmail.com
Tue Feb 12 18:33:18 UTC 2019


On Tuesday, 12 February 2019 at 18:26:56 UTC, jmh530 wrote:
> On Tuesday, 12 February 2019 at 14:44:10 UTC, ag0aep6g wrote:
>> [snip]
>>
>> Ouch. That looks bad. A reduction:
>>
>> ----
>> struct S
>> {
>>     ulong c;
>>     bool b;                  // removing this prevents bug
>> }
>>
>> void main()
>> {
>>     S[1] a = [S(42)];
>>     assert(a[0].c == 42); /* Passes. */
>>     f(a);
>> }
>>
>> void f(S[1] a)
>> {
>>     assert(a[0].c == 42); /* Fails. */
>> }
>> ----
>>
>> Fails since 2.070. https://run.dlang.io/is/LBhn4l
>
> For whatever strange reason, your post gave me a completely 
> unrelated idea:
>
> When we have issues like this that get posted to bugzilla, 
> there is (almost) always a code snippet, but unittests are only 
> created when there an actual fix has been made. Except for what 
> is in bugzilla DMD's source doesn't really know anything about 
> the interaction of bugs. For instance, if fixing one bug would 
> also fix another, we wouldn't know that unless someone marked a 
> bug as duplicate.
>
> To improve the situation, we could add a unittest for every new 
> bug. The immediate problem with this is that since these are 
> bugs, they would all fail.

There are plenty of tests of things that fail already in the dmd 
test suite, the only difference being that those are for things 
that *should* fail.

I put this sort of idea to Walter 1 or 2 DConfs ago, I think the 
result was "That sounds interesting, someone should do it".


More information about the Digitalmars-d mailing list