digitalmars.D.bugs - [Issue 23450] New: Unexpected constructor behaviour in DMD in rare
- d-bugmail puremagic.com (47/47) Nov 01 2022 https://issues.dlang.org/show_bug.cgi?id=23450
https://issues.dlang.org/show_bug.cgi?id=23450 Issue ID: 23450 Summary: Unexpected constructor behaviour in DMD in rare cases Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: keivan.shah silverleafcaps.com Today I came across a strange bug while using D with dmd. I have still not been able to figure out under what conditions does it happen but it seems to be a DMD related bug to me. Here is a reproducible snippet of the code ``` import std; alias DG = void delegate(); class TType { } class MyClass { this(TType t1, TType, double, double[2], double, double, DG, TType, TType, DG, DG, DG, double, double, double, double, double, ulong, bool) { assert(t1 is null); // I am passing null so should be null! // NOTE: Seems to work in LDC but fails in DMD. writeln("No Bug!"); } } void main() { auto tt = new TType; new MyClass(null, tt, 0, [0, 0], 0, 0, null, null, null, null, null, null, 0, 0, 0, 0, 0, 0, false); } ``` The code gives an assertion failure on the current versions of dmd (reproducible on run.dlang.io as well) and does not happen when using LDC. The bug seems to be sensitive to the number of arguments and their types making it reproducible only in very limited cases. I have tried my best to reduce it to minimum but still does require these many arguments. The end results seems to me like variables are shifted i.e. variable 1 gets value of variable 2 and so on, but don't have enough proof to support this. --
Nov 01 2022