I have an xcode project which has both cpp and swift code. In one of my usecase I am passing primitive type variables from swift to cpp by reference( primitives types list here as per the new cpp-swift interop documentation)
swift code:
// primitive check code:Bool
var x : Bool = true
// When we are passing a variable as a Reference, we need to use explicitly use'&'
student.PassBoolAsReferenceType (&x) // interop call to cpp code
print (x)
Cpp code:
void
Student::PassBoolAsReferenceType(bool &pValue) noexcept
{
std::cout << pValue << std::endl;
pValue = false;
}
The above code fails during compilation with no clear error message "Command SwiftCompile failed with a nonzero exit code"
However, all the other primitive types that I tested worked for the above code like Int, Float, Double etc. Only the Bool interop fails. Can someone explain why is it not possible for bool? I m using the new interop introduced in swift 5.9.