www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2779] New: alias this + tuple expansion on function call doesn't work

http://d.puremagic.com/issues/show_bug.cgi?id=2779

           Summary: alias this + tuple expansion on function call doesn't
                    work
           Product: D
           Version: 2.027
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: dsimcha yahoo.com


struct Tuple(T...) {
    T data;
    alias data this;
}

void doStuff(uint a, float b) {}

void main() {
    Tuple!(uint, float) foo;
    doStuff(foo[0], foo[1]); // Works.
    doStuff(foo.tupleof);  // Works.
    doStuff(foo.data);  // Works.

    // Error: function test.doStuff (uint a, float b)
    // does not match parameter types (Tuple!(uint,float))
    // Error: cannot implicitly convert expression (foo) of type
    // Tuple!(uint,float) to uint|
    // Error: expected 2 function arguments, not 1
    doStuff(foo);
}


-- 
Apr 01 2009