[stdlib] Resolve the ambiguity for Int32.init(bitPattern:)

When this initializer is invoked with an integer literal, the expression
is ambiguous, since both UIn32 and Float are
RepresentableByIntegerLiteral.

Fixes: https://bugs.swift.org/browse/SR-5176
This commit is contained in:
Max Moiseev
2017-06-12 12:49:17 -07:00
parent 94c00c4b6a
commit 90a20ea015
4 changed files with 88 additions and 2 deletions

View File

@@ -79,3 +79,7 @@ func negativeShift(_ u8: UInt8) {
_ = (u8 << -1)
}
#endif
func sr5176(description: String = "unambiguous Int32.init(bitPattern:)") {
_ = Int32(bitPattern: 0) // should compile without ambiguity
}