<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 - auto trick for recursive lambdas works with gcc, but not always with clang"
   href="https://bugs.llvm.org/show_bug.cgi?id=47564">47564</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>auto trick for recursive lambdas works with gcc, but not always with clang
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>10.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>enhancement
          </td>
        </tr>

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

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

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

        <tr>
          <th>Reporter</th>
          <td>janezz55@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=23976" name="attach_23976" title="example file illustrating the bug">attachment 23976</a> <a href="attachment.cgi?id=23976&action=edit" title="example file illustrating the bug">[details]</a></span>
example file illustrating the bug

Take this example:

auto const f([](int const i, auto ...) noexcept -> int
  {
    return i == 1 ? 1 : i * operator()(i - 1);
  }
);

under gcc 10.2.0 the lambda will compile and work as expected - and will do so
every time an auto argument is used, but clang 10.0.1 reports:

t.cpp:6:31: error: use of undeclared 'operator()'

If I omit the auto arguments with gcc, it reports:

t.cpp:6:31: error: 'operator()' not defined

However, the auto trick does work with clang - I have more complex lambdas with
which it does work. I find the trick very useful. Could you make it work with
clang every time, just like is the case with gcc?</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>