www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8577] New: static assert is triggered after tuple bounds check

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

           Summary: static assert is triggered after tuple bounds check
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: ellery-newcomer utulsa.edu


--- Comment #0 from Ellery Newcomer <ellery-newcomer utulsa.edu> 2012-08-21
13:17:04 PDT ---
I find it very annoying that the following code results in a tuple out of
bounds error message and not only the static assert message.

template T(Ts...) {
    static assert(Ts.length > 1);
    alias Ts[1] Z;
}

void main() {
    alias T!(int).Z Z2;
}

gives

wiz.d(4): Error: tuple index 1 exceeds 1
wiz.d(3): Error: static assert  (1LU > 1LU) is false
wiz.d(8):        instantiated from here: T!(int)

I think error reporting should stop at the static assert.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 21 2012