title: structured bindings and range-based-for; supress unused warning in gcc
body: <p>I want to traverse a map using structure bindings, ignoring the key:</p>
  
  <pre><code>for (auto&amp; [unused, val] : my_map)
       do_something(val);
  </code></pre>
  
  <p>I have tried different options with gcc-7.2.0:</p>
  
  <pre><code>// The warning is issued
  for ([[maybe_unused]] auto&amp; [unused, val] : my_map)
        do_something(val);
  
  // Syntax error
  for (auto&amp; [[[maybe_unused]] unused, val] : my_map)
        do_something(val);
  
  // The same two combinations above with [[gnu::unused]].
  </code></pre>
  
  <p>It seems that the <code>[[maybe_unused]]</code> attribute is not implemented yet for structure bindings.</p>
  
  <p>Is there any simple solution to this? Any macro, gcc/gnu extension, or any pragma to temporarily supress that specific warning is fine to me; for example, disabling it during the whole function body where I'm using the range-based-for, because the function I'm using this is pretty short (it is basically two range-for-loops over two different maps with exact behaviour). </p>
  
  <p>The (relevant) options I'm using to compile the project are:</p>
  
  <pre><code>-std=c++17 -Wall -Wextra -Werror -pedantic -pedantic-errors
  </code></pre>
  
  <p>What I have current to go on is, but that's ugly:</p>
  
  <pre><code>for (auto&amp; [unused, val] : my_map)
     (void)unused, do_something(val);
  </code></pre>