public struct Foo
{
        public void Create(T)(uint delegate(T) c, T param)
        {       
        }
}

Foo f;

f.Create((x) { }, "asdf");

cannot deduce arguments compiler error.

Surely D can figure out that T is a string?

If one simply changes this to

public struct Foo(T)
{
        public void Create(uint delegate(T) c, T param)
        {       
        }
}

and

Foo!string f;

everything works.

The second parameter is a string so why not infer that T is a string?

Also, if one does

f.Create((string x) { }, "asdf");

Then it works. Seems like a blatant limitation in D's type inferencing system.




Reply via email to