digitalmars.D.bugs - [Issue 18708] New: Flow analysis in constructors not done correctly
- d-bugmail puremagic.com (42/42) Apr 02 2018 https://issues.dlang.org/show_bug.cgi?id=18708
https://issues.dlang.org/show_bug.cgi?id=18708 Issue ID: 18708 Summary: Flow analysis in constructors not done correctly for if, ||, && Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: bugzilla digitalmars.com struct S { int y; disable this(); } // so construction is required class C { S s; this(S t) { if (bar(s = t)) foo(); // bug: Error: one path skips field s } this(S t, int i) { i || bar(s = t); // bug: should give error } this(S t, int i, int j) { i && bar(s = t); // bug: should give error } this(S t, int i, long j) { i ? bar(s = t) : i; // good: Error: one path skips field s } this(S t, int i, long j) { i ? i : bar(s = t); // good: Error: one path skips field s } } int bar(S s); int foo(); --
Apr 02 2018