title: Alias for a lambda
body: <p>The ISO C++ FAQ (<a href="https://isocpp.org/wiki/faq/cpp11-language-templates" rel="nofollow noreferrer">https://isocpp.org/wiki/faq/cpp11-language-templates</a>, "Template aliases") quotes the following example:</p>
  
  <pre><code>using P = [](double)-&gt;void; // using plus suffix return type
  </code></pre>
  
  <p>I get an error trying to compile this with g++ -std=c++11:</p>
  
  <pre><code>error: expected type-specifier before ‘[’ token
  </code></pre>
  
  <p>What should the correct syntax be? If I do</p>
  
  <pre><code>auto p = [](double)-&gt;void {};
  </code></pre>
  
  <p>p gets deduced to be either <code>&lt;lambda(double)&gt;</code> or <code>main()::&lt;lambda(double)&gt;</code>, depending on the scope. However, I can't then do</p>
  
  <pre><code>using P = &lt;lambda(double)&gt;;
  </code></pre>
  
  <p>as that also gives an error:</p>
  
  <pre><code>expected type-specifier before ‘&lt;’ token
  </code></pre>