title: Using 'void' template arguments in C++
body: <p>Take the following minimal example:</p>
  
  <pre><code>using Type1 = std::function&lt;void(void)&gt;;
  
  template &lt;typename T&gt;
  using Type2 = std::function&lt;void(T)&gt;;
  
  Type1 whyDoesThisWork;
  Type2&lt;void&gt; andYetThisDoesNot;
  </code></pre>
  
  <p>If the second type alias, I get the error "Argument may not have 'void' type". (I tested with Xcode 4.5, Clang/c++11/libc++, OS X 10.7.)</p>
  
  <p>I find this curious: I would have expected <code>Type1</code> and <code>Type2&lt;void&gt;</code> to behave identically. What's going on here? And is there a way to rewrite the second type alias so I <em>can</em> write <code>Type2&lt;void&gt;</code> and get <code>std::function&lt;void(void)&gt;</code> instead of an error?</p>
  
  <p><strong>Edit</strong> I should probably add that the reason I want this is to allow for something like the following:</p>
  
  <pre><code>template &lt;typename ... T&gt;
  using Continuation = std::function&lt;void(T...)&gt;;
  
  auto someFunc = []() -&gt; void {
    printf("I'm returning void!\n");
  };
  
  Continuation&lt;decltype(someFunc())&gt; c;
  </code></pre>
  
  <p><code>Continuation&lt;decltype(someFunc())&gt;</code> becomes <code>Continuation&lt;void&gt;</code> and I get the error.</p>