[Issue 581] New: Error message without line number in tricky template code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 21 06:40:31 PST 2006


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

           Summary: Error message without line number in tricky template
                    code
           Product: D
           Version: 0.174
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: clugdbug at yahoo.com.au


I had trouble cutting this one down, subtle changes will make the bug
disappear; but probably this test case is far more complex than necessary.

Output:
-----------
3bug20__T4MangS9_Dmain
Error: cannot cast int to char[]
Error: non-constant expression cast(char[])0

Note: for this test, filename must be exactly 3 letters long, eg "bug.d"
--------
template Mang(alias F)
{
    enum H { ignore }
    alias void function (H ) G;
    const char [] J = typeof(G).mangleof[3..$-8];
}

template X(){}

template D(char [] str){}

template A(char [] str)
{
    static if (str.length==22)
        const char [] A = str;
    else static if (str[4]<='9')
        const char [] A = A!(str[4..$]);
    else static if (D!(str[str]))
    {}
    else const char [] A = .X!();
}

template M(alias B)
{
   const char [] M = A!(Mang!(B).J);
}

void main()
{
    int q = 3;
   pragma(msg, M!(q));
}
--------


-- 




More information about the Digitalmars-d-bugs mailing list