title: delegate is deduced to void when calling template function in D(LDC2)
body: <p>I have a custom <code>Option</code> type written using <code>Algebraic</code>.</p>
  
  <pre><code>struct None{};
  struct Some(T){
      T t;
  
      alias t this;
  
      T get(){
          return t;
      }
  };
  
  alias Option(T) = Algebraic!(Some!(T), None);
  Option!T some(T)(T t){
      return Option!T(Some!T(t));
  }
  Option!T none(T)(){
      return Option!T(None());
  }
  </code></pre>
  
  <p>Then I try to write some basic convenience functions:</p>
  
  <pre><code>T getValue(T,uint size)(VariantN!(size, Some!T, None) opt){
      return opt.get!(Some!T).t;
  }
  
  bool isDefined(T, uint size)(VariantN!(size, Some!T, None) opt){
      return opt.convertsTo!(Some!T);
  }
  
  A match(A,T,uint size)(VariantN!(size, Some!T, None) opt, A delegate(T) some, A delegate() none){
      if(opt.isDefined!(T,size)){
          return some(opt.getValue!(T,size));
      }else{
          return none();
      }
  }
  </code></pre>
  
  <p>When calling <code>match</code> compiler fails to deduce correct arguments to template:</p>
  
  <pre><code> Option!int test = some(1);
   bool boolReturn = test.match((x) =&gt; false, () =&gt; true);
  </code></pre>
  
  <p>With error:</p>
  
  <pre><code>    Error: template util.match cannot deduce function from argument types !()(VariantN!(4LU, Some!int, None), void, bool function() pure nothrow @nogc @safe), candidates are:
  src/util.d(79,3):        util.match(A, T, uint size)(VariantN!(size, Some!T, None) opt, A delegate(T) some, A delegate() none)
  </code></pre>
  
  <p>The error output states that the second argument to <code>match</code> ( meaning <code>bool delegate(int)</code> or <code>(x) =&gt; false</code> ) is deduced to <code>void</code>. Why ?</p>
  
  <p>This example compiles (all the same but type of x is explicitly given):</p>
  
  <pre><code>Option!int test = some(1);
  bool boolReturn = test.match((int x) =&gt; false, () =&gt; true);
  </code></pre>