title: Template comparison changes inside template body
body: <p>I have a struct <code>Foo!T</code> and a function that operates on any two <code>Foo!T</code>.
  I would expect such a function to be declared</p>
  
  <pre class="lang-d prettyprint-override"><code>void fun(U)(U a, U b) if (is(U : Foo!T, T...)) { }
  </code></pre>
  
  <p>However, it turns out that I can declare it as</p>
  
  <pre class="lang-d prettyprint-override"><code>void fun(U)(U a, U b) if (is(U : Foo)) { }
  </code></pre>
  
  <p><em>only if</em> I declare it <em>inside</em> the body of <code>Foo</code>.</p>
  
  <p>For example:</p>
  
  <pre class="lang-d prettyprint-override"><code>struct Foo(T) { 
      void fun1(U)(U b) if (is(U : Foo)) { } 
  }
  
  void fun2(U)(U a, U b) if (is(U : Foo)) { }
  
  unittest {
      Foo!int f;
      f.fun1(f);
      f.fun2(f);
  }
  </code></pre>
  
  <p>The above fails with <code>struct d.Foo(T) is used as a type</code> on the invocation of
  <code>fun2</code>. <code>fun1</code>, however, is fine.</p>
  
  <p>Why is the constraint <code>is(U : Foo)</code> valid inside the body of <code>Foo</code>, but not
  outside? </p>
  
  <p>Is the comparison <code>is(U : Foo)</code> inside the body of <code>Foo</code> equivalent to <code>is(U :
  Foo!V, V...)</code> outside the body of <code>Foo</code>?</p>