title: How can I apply the [[nodiscard]] attribute to a lambda?
body: <p>I want to prevent people from calling the lambda without handling the return value.</p>
  
  <p>Clang 4.0 refuses everything I've tried, compiling with -std=c++1z:</p>
  
  <pre><code>auto x = [&] [[nodiscard]] () { return 1; };
  // error: nodiscard attribute cannot be applied to types
  </code></pre>
  
  <pre><code>auto x = [[nodiscard]] [&]() { return 1; };
  // error: expected variable name or 'this' in lambda capture list</code></pre>
  
  <pre><code>auto x [[nodiscard]] = [&]() { return 1; };
  // warning: nodiscard attribute only applies to functions, methods, enums, and classes</code></pre>
  
  <pre><code>[[nodiscard]] auto x = [&]() { return 1; };
  // warning: nodiscard attribute only applies to functions, methods, enums, and classes</code></pre>
  
  <pre><code>auto x = [&]() [[nodiscard]] { return 1; };
  // error: nodiscard attribute cannot be applied to types</code></pre>
  
  <p>Is this some sort of bug in clang or a hole in the standard?</p>