digitalmars.D.bugs - [Issue 21975] New: is expression ignores implicit conversion of
- d-bugmail puremagic.com (46/46) May 25 2021 https://issues.dlang.org/show_bug.cgi?id=21975
https://issues.dlang.org/show_bug.cgi?id=21975 Issue ID: 21975 Summary: is expression ignores implicit conversion of struct via alias this when pattern matching Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: snarwin+bugzilla gmail.com The following program fails to compile as of DMD 2.096.1: --- struct Outer(T) { Inner!T inner; alias inner this; } struct Inner(T) { T t; } static assert(is(Outer!int : Inner!int)); // ok static assert(is(Outer!int : Inner!T, T)); // error --- The error message is: -- bug.d(11): Error: static assert: `is(Outer!int : Inner!T, __isexp_id2, T)` is false --- The expected behavior is for both static assert statements to pass. Surprisingly, changing Inner and Outer from structs to classes causes the second static assert statement to pass: --- class Outer(T) { Inner!T inner; alias inner this; } class Inner(T) { T t; } static assert(is(Outer!int : Inner!int)); // ok static assert(is(Outer!int : Inner!T, T)); // ok --- --
May 25 2021