[Issue 20854] New: IFTI does not see parameterized base type of enum

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 21 21:05:29 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20854

          Issue ID: 20854
           Summary: IFTI does not see parameterized base type of enum
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: schveiguy at yahoo.com

Since an enum is essentially a typedef, it should perform similarly to alias
this.

Example:

struct S(T)
{
    T t;
}

void foo(T)(S!T item)
{
}

struct U {
    S!int s;
    alias s this;
}

enum V : S!int {
    x = S!int(1)
}

void main()
{
    S!int s;
    U u;
    foo(s); // ok
    foo(u); // ok
    //foo(V.x); // fails to compile
}

--


More information about the Digitalmars-d-bugs mailing list