Skip to content

Commit d378e70

Browse files
authored
Merge pull request #36030 from slavapestov/fix-float16-availability-on-macos-5.4
stdlib: Float16 needs an @available annotation for macOS [5.4]
2 parents 2f19875 + 2707d3d commit d378e70

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

stdlib/public/core/FloatingPointTypes.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ internal struct _${Self}AnyHashableBox: _AnyHashableBox {
13531353
${SelfDocComment}
13541354
@frozen
13551355
% if bits == 16:
1356-
@available(iOS 14, tvOS 14, watchOS 7, *)
1356+
@available(macOS 11, iOS 14, tvOS 14, watchOS 7, *)
13571357
@available(macOS, unavailable)
13581358
@available(macCatalyst, unavailable)
13591359
% else:

test/IRGen/float16_macos.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %target-swift-frontend -emit-ir %s -target x86_64-apple-macos10.15 | %FileCheck %s --check-prefix=CHECK10
2+
// RUN: %target-swift-frontend -emit-ir %s -target x86_64-apple-macos11 | %FileCheck %s --check-prefix=CHECK11
3+
4+
// REQUIRES: OS=macosx
5+
// REQUIRES: CPU=x86_64
6+
// UNSUPPORTED: use_os_stdlib
7+
8+
@available(macOS 11, *)
9+
public struct Float16Wrapper {
10+
@available(macOS, unavailable)
11+
var x: Float16
12+
}
13+
14+
// CHECK10-LABEL: @"$ss7Float16VMn" = extern_weak global %swift.type_descriptor
15+
// CHECK11-LABEL: @"$ss7Float16VMn" = external global %swift.type_descriptor

0 commit comments

Comments
 (0)