title: structured binding with [[maybe_unused]]
body: <p>Functional languages with pattern matching (sometimes?) have the possibility to ignore some bound values, but with C++17 structured bindings there seem to be no way to do that (<a href="https://stackoverflow.com/questions/40673080/stdignore-with-structured-bindings">std::ignore with structured bindings?</a>). The advice is to use a dummy name, but then we'll get warnings about unused variables. </p>
  
  <p>With the latest heads of both clang and gcc, this does the expected thing, which is nice and useful,</p>
  
  <pre><code>[[maybe_unused]] auto x =4 ; // fine, no warning
  [[maybe_unused]] auto [a,dummyb,dummyc] = std::tuple&lt;int,int,float&gt;(1,1,1.0f); 
  </code></pre>
  
  <p>but I would also have hoped this would work:</p>
  
  <pre><code>auto [g,[[maybe_unused]]dummyh,[[maybe_unused]]dymmyi] =
        std::tuple&lt;int,int,float&gt;(1,1,1.0f);
  </code></pre>
  
  <p>is there a specific reason <a href="http://en.cppreference.com/w/cpp/language/attributes" rel="noreferrer">attributes</a> can not be used here? (in the standard as well as technically). Neither gcc or clang accepts this.</p>
  
  <hr>
  
  <p>Edit, collecting the support status: (thanks to <a href="https://gcc.godbolt.org/" rel="noreferrer" title="godbolt/Compiler explorer">godbolt/compiler explorer</a>). It works as expected in (could be earlier also):</p>
  
  <ul>
  <li>gcc 8.0 trunk (g++ 8.0.0 20171015 experimental)</li>
  <li>clang 4.0.0</li>
  <li>icc 18 (not tested, according to <a href="https://software.intel.com/en-us/articles/c17-features-supported-by-intel-c-compiler" rel="noreferrer" title="spec">specs</a>)</li>
  <li>msvc 19.22 (probably earlier) (Fixed, according to <a href="https://developercommunity.visualstudio.com/content/problem/113023/maybe-unused-with-structured-binding-still-causes.html" rel="noreferrer">bug report</a>)</li>
  </ul>
  
  <p>Try it out in godbolt at <a href="https://gcc.godbolt.org/z/H2duYd" rel="noreferrer">https://gcc.godbolt.org/z/H2duYd</a></p>