Possible bug

Sergei Nosov sergei.nosov at gmail.com
Mon Mar 25 06:11:02 PDT 2013


Hi!

This code doesn't compile with dmd v2.062 on Linux_x86_64

<pre>
struct test(T)
{
     T *data_;
     this(T *data) {
         data_ = data;
     }
}

void main()
{
     int *cptr = null;
     test!int hello = test(cptr);
}
</pre>

Error:
dmd test.d
test.d(12): Error: struct test.test does not match any function 
template declaration. Candidates are:
test.d(2):        test.test(T)
test.d(12): Error: struct test.test(T) cannot deduce template 
function from argument types !()(int*)

Everything's fine if I specify parameters explicitly:
<pre>
test!int hello = test!int(cptr);
</pre>


More information about the Digitalmars-d-learn mailing list