<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 - C++17 Lambda-expression with implicit capture fails to compile."
   href="https://bugs.llvm.org/show_bug.cgi?id=43293">43293</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>C++17 Lambda-expression with implicit capture fails to compile.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

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

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

        <tr>
          <th>Reporter</th>
          <td>chackz0x12@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22489" name="attach_22489" title="reproducible">attachment 22489</a> <a href="attachment.cgi?id=22489&action=edit" title="reproducible">[details]</a></span>
reproducible

Good day,

I believe I may have discovered a bug in TOT clang. When compiling the attached
reproducible with the following command:

clang ./repro.cpp -g -O2 -std=gnu++17

I get the following error message:

./repro.cpp:9:19: error: variable 'myFoo' cannot be implicitly captured in a
lambda with no capture-default specified
    static_assert(myFoo);

I've checked cpp reference and done a, albeit shallow, dive into the spec and I
can't find any contrary definitions that state the repro shouldn't compile.

The test compiles fine with GCC 9.2 on godbolt and also with clang 8.0.

The change in behaviour was introduced in r363086,
715f7a1bd058c64a39cc4773114dfb46ae8cc8a3 (monorepo).

can anyone confirm the following.

1. the test is either well formed or not.
2. is this a genuine bug.

Thank you for your valuable time.

Tom W</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>