<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - bogus lambda capture is not required warnings [-Wunused-lambda-capture]"
   href="https://bugs.llvm.org/show_bug.cgi?id=35669">35669</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>bogus lambda capture is not required warnings [-Wunused-lambda-capture]
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>boris@codesynthesis.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following two cases trigger bogus warnings:

    auto& sm (scope_map::instance);

    auto make_global_scope = [&sm] () -> scope&
    {
      auto i (sm.insert (dir_path (), false));
      scope& r (i->second);
      r.out_path_ = &i->first;
      global_scope = scope::global_ = &r;
      return r;
    };

warning: lambda capture 'sm' is not required to be captured for this use
[-Wunused-lambda-capture]

    auto& vp (variable_pool::instance);

    auto set = [&vp, &gs] (const char* var, auto val)
    {
      using T = decltype (val);
      gs.assign (vp.insert<T> (var)) = move (val);
    };

warning: lambda capture 'vp' is not required to be captured for this use
[-Wunused-lambda-capture]

Both sm and vp are references to global variables. For the complete build log,
see:

<a href="https://stage.build2.org/?builds=&pn=build2&cf=linux-clang_5.0">https://stage.build2.org/?builds=&pn=build2&cf=linux-clang_5.0</a>

The same problem exists in trunk at the time of this report.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>