[Issue 14286] `alias this` not considered sub-typing in is() expression
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 23 09:15:11 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=14286
Simen Kjaeraas <simen.kjaras at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simen.kjaras at gmail.com
--- Comment #2 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
Indeed. For clarification: the inner struct can be templated, the outer cannot:
struct Inner1 {}
struct Inner2() {}
struct Outer1 { Inner1 a; alias a this; }
struct Outer2 { Inner2!() a; alias a this; }
struct Outer3() { Inner1 a; alias a this; }
struct Outer4() { Inner2!() a; alias a this; }
// Non-template outer struct:
static assert( is(Outer1 : Inner1));
static assert( is(Outer2 : Inner2!()));
// Templated outer struct:
static assert(!is(Outer3 : Inner1));
static assert(!is(Outer4 : Inner2!()));
--
More information about the Digitalmars-d-bugs
mailing list