www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19121] New: Indexing a struct with a tuple alias this doesn't

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

          Issue ID: 19121
           Summary: Indexing a struct with a tuple alias this doesn't give
                    you the thing at given index
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: yshuiv7 gmail.com

struct A(T...) {
    alias S = T;
    alias S this;
}

alias X = A!(int, double);
alias Y = X[0]; // Fine
pragma(msg, Y); // Not int ?!?!
// A!(int, double)[0] ???

Y y;
pragma(msg, typeof(y));
pragma(msg, is(typeof(y) == int)); // false ?!

--
Jul 27 2018