[llvm-bugs] [Bug 44567] New: Lambda incorrectly passes SNIFAE check for bool conversion in Objective-C++

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 16 05:46:38 PST 2020


            Bug ID: 44567
           Summary: Lambda incorrectly passes SNIFAE check for bool
                    conversion in Objective-C++
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rajveer_aujla at hotmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Created attachment 23020
  --> https://bugs.llvm.org/attachment.cgi?id=23020&action=edit
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

This error message is correct, however the compiler shouldn't get to this stage
since the template check should fail for Objective-C++ too.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200116/bc75e088/attachment.html>

More information about the llvm-bugs mailing list