Thread overview
[Issue 581] New: Error message without line number in tricky template code
Nov 21, 2006
d-bugmail
[Issue 581] Error message w/o line number in dot-instantiated template
Jan 02, 2008
d-bugmail
Jul 09, 2008
d-bugmail
Jul 10, 2008
d-bugmail
November 21, 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@digitalmars.com
        ReportedBy: clugdbug@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));
}
--------


-- 

January 02, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=581


clugdbug@yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Error message without line  |Error message w/o line
                   |number in tricky template   |number in dot-instantiated
                   |code                        |template




------- Comment #1 from clugdbug@yahoo.com.au  2008-01-02 09:13 -------
I cut this example down a lot - to one line in fact!
It's the . in the template instantiation that triggers it.
---------------------------
static assert(.a!().b);
---------------------------
Output:
-----------
bug.d(15): Error: template identifier a is not a member of module bug Error: no property 'b' for type 'int'
--------


-- 

July 09, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=581


clugdbug@yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from clugdbug@yahoo.com.au  2008-07-09 07:14 -------
Fixed DMD1.032


-- 

July 10, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=581





------- Comment #3 from bugzilla@digitalmars.com  2008-07-09 22:36 -------
Fixed dmd 1.032 and 2.016


--