[Issue 5686] class template error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 3 07:19:27 PST 2011


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



--- Comment #6 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-03-03 07:16:34 PST ---
With some testing, I discovered that it's the act of explicit instantiation
that causes the line number to be tied to the declaration line:

ptrdiff_t Test1(string name, string file = __FILE__, ptrdiff_t line =
__LINE__)(){
    pragma(msg, line.stringof);
    return line ;
}

void main(){
    auto test1 = Test1!("test")();
}

prints 1.

This workaround does work:

Test2!(file, line) createTest2(string file = __FILE__, ptrdiff_t line =
__LINE__)()
{
   return new Test2!(file line);
}

I agree with the request that the line number and file should be tied to the
instantiation line, not the declaration line.

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


More information about the Digitalmars-d-bugs mailing list