title: Forming reference to void
body: <p>I have a template class that should allow <code>void</code> as a template parameter. This class does have a function that passes a reference of the parameter, so I did the following:</p>
  
  <pre><code>template &lt;typename T&gt;
  struct trait
  {
      typedef typename boost::conditional&lt;
          boost::is_void&lt;T&gt;::value,
          void, T &amp;
      &gt;::type type;
  };
  
  template &lt;typename T&gt;
  struct foo
  {
      typename trait&lt;T&gt;::type ref()
      {
          // do something
      }
  };
  </code></pre>
  
  <p>Yet the compiler claims I would form a reference to <code>void</code> in instantiation of <code>struct trait&lt;void&gt;</code>. Why so and how can I achieve what I want?</p>