mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user