www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20854] New: IFTI does not see parameterized base type of enum

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 puremagic.com
          Reporter: schveiguy 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
}

--
May 21