Is this a bug?

Márcio Martins marcioapm at gmail.com
Mon Oct 15 16:40:07 UTC 2018


import std.stdio;

void incx(T, Args...)(ref T t) {
     ++t.x;
}

static struct Test(T) {
     T x;
}

void main() {
     Test!uint t;
     t.incx();           // works
     t.incx!();          // works
     incx(t);            // works
     t.incx!(1, 2, 3);   // what?
     incx(t, 1, 2, 3);   // what?
     writeln(t.x);
}


test.d(16): Error: template test.incx cannot deduce function from 
argument types !(1, 2, 3)(Test!uint), candidates are:
test.d(3):        test.incx(T, Args...)(ref T t)
test.d(17): Error: template test.incx cannot deduce function from 
argument types !()(Test!uint, int, int, int), candidates are:
test.d(3):        test.incx(T, Args...)(ref T t)
Failed: ["/usr/bin/dmd", "-v", "-o-", "test.d", "-I."]



More information about the Digitalmars-d-learn mailing list