digitalmars.D.bugs - [Issue 21856] New: Implicit safe violation of immutable
- d-bugmail puremagic.com (39/39) Apr 23 2021 https://issues.dlang.org/show_bug.cgi?id=21856
https://issues.dlang.org/show_bug.cgi?id=21856 Issue ID: 21856 Summary: Implicit safe violation of immutable Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: regression Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: thomas.bockman gmail.com f!() below is incorrectly inferred as safe, and the invalid implicit cast to immutable is permitted. ///////////////////////////////////// module app; class D { } class DA : D { } immutable(D) f()(DA right) { D ret = right; return ret; } void main() { import std.stdio : writeln; writeln(typeof(f!()).stringof); } ///////////////////////////////////// Up to 2.062 : Failure with output: ----- onlineapp.d(8): Error: cannot implicitly convert expression (ret) of type app.D to immutable(D) onlineapp.d(13): Error: template instance app.f!() error instantiating ----- 2.063 to 2.065.0: Success with output: pure nothrow safe immutable(D)(DA right) Since 2.066.0: Success with output: pure nothrow nogc safe immutable(D)(DA right) --
Apr 23 2021