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.
main.mm
(829 bytes, text/x-csrc)Created attachment 23020 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 ofexecute
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.