www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12586] New: redundant error messages for tuple index exceeding

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

          Issue ID: 12586
           Summary: redundant error messages for tuple index exceeding
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

Test case:

alias TypeTuple(T...) = T;
alias binaryFun(alias fun) = fun;

void main()
{
    int f(int v) { return v; }

    alias fun = TypeTuple!(f);
    alias Types = TypeTuple!(int, int);

    foreach (i, Unused; Types)
    {
        binaryFun!(fun[i])(1);
    }
}

Prints:
---
test.d(14): Error: tuple index 1 exceeds length 1
test.d(14): Error: tuple index 1 exceeds 1

Should be:
---
test.d(14): Error: tuple index 1 exceeds length 1

--
Apr 15 2014