disable array/string -> pointer conversions in operator contexts that lack an &. They

are still allowed in non-operator calls.



Swift SVN r30398
This commit is contained in:
Chris Lattner
2015-07-20 15:54:13 +00:00
parent 364176d007
commit 33c6de5001
2 changed files with 9 additions and 4 deletions

View File

@@ -1804,6 +1804,8 @@ ConstraintSystem::matchTypes(Type type1, Type type2, TypeMatchKind kind,
ConversionRestrictionKind::BridgeToNSError);
}
// Pointer arguments to non-operator calls can be converted from
// pointer-compatible types.
// Pointer arguments can be converted from pointer-compatible types.
if (kind >= TypeMatchKind::ArgumentConversion) {
if (auto bgt2 = type2->getAs<BoundGenericType>()) {
@@ -1834,7 +1836,10 @@ ConstraintSystem::matchTypes(Type type1, Type type2, TypeMatchKind kind,
ConversionRestrictionKind::InoutToPointer);
}
if (!(flags & TMF_ApplyingOperatorParameter)) {
if (!(flags & TMF_ApplyingOperatorParameter) &&
// Operators cannot use these implicit conversions.
(kind == TypeMatchKind::ArgumentConversion ||
kind == TypeMatchKind::ArgumentTupleConversion)) {
auto bgt1 = type1->getAs<BoundGenericType>();
// We can potentially convert from an UnsafeMutablePointer