[Issue 2779] New: alias this + tuple expansion on function call doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 1 12:15:45 PDT 2009


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 at digitalmars.com
        ReportedBy: dsimcha at 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);
}


-- 



More information about the Digitalmars-d-bugs mailing list