<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 - Lambda incorrectly passes SNIFAE check for bool conversion in Objective-C++"
   href="https://bugs.llvm.org/show_bug.cgi?id=44567">44567</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Lambda incorrectly passes SNIFAE check for bool conversion in Objective-C++
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rajveer_aujla@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23020" name="attach_23020" title="Code sample">attachment 23020</a> <a href="attachment.cgi?id=23020&action=edit" title="Code sample">[details]</a></span>
Code sample

The attached file has a SNIFAE check to see if a type T can be converted to a
bool (`bool(T)`), and a set of `execute` functions where the correct one is
picked based on this check. When compiled as C++17, this check correctly fails
when the type T is a lambda and the file type is .cpp.

If the file is renamed to .mm however (to make the file be compiled as
Objective-C++), the SNIFAE check incorrectly passes, which leads to the
incorrect `execute` function being invoked. This then fails as the lambda is
attempted to be converted to an Objective-C block, with the following error:

Call to implicitly-deleted copy constructor of 'const (lambda at
.../main.mm:68:25)'

This error message is correct, however the compiler shouldn't get to this stage
since the template check should fail for Objective-C++ too.</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>