Why do ints defined in template mixins have garbage values?

Michelle Long HappyDance321 at gmail.com
Wed Dec 12 21:13:09 UTC 2018


On Wednesday, 12 December 2018 at 16:33:02 UTC, H. S. Teoh wrote:
> On Wed, Dec 12, 2018 at 01:35:00PM +0000, AlCaponeJr via 
> Digitalmars-d-learn wrote:
>> On Tuesday, 11 December 2018 at 21:17:46 UTC, H. S. Teoh wrote:
>> > Whoa.  That looks like a compiler bug. File a bug here:
>> > ...
>> 
>> Genuinely asking if this is a case of lacking of unit test for 
>> the Compiler or this is a case that where is hard to test or 
>> prevent?
> [...]
>
> I think it's just a case of too many possible combinations of 
> features to test that some inevitably get overlooked.  
> Combinatorial explosion. But once bug reports like these are 
> filed and fixed, more unittests will be added, which increase 
> the surface area of tested feature combinations and (hopefully) 
> reduce the likelihood of similar bugs.
>
>

Proper factorization prevents this. It may be a difficult problem 
but all it requires is to think before one leaps. People have 
already developed randomized program testing(essentially 
generates random but working programs(or non-working for error 
codes)).  Someone could setup a machine that continuously 
generates these programs and tests the compiler. Any 
discrepancies are reported and investigated.



More information about the Digitalmars-d-learn mailing list