mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Depending on deployment target and platform, the function called to diagnose reaching unavailable code could be `_diagnoseUnavailableCodeReached()` itself, the back-deployment thunk, or the `@_alwaysEmitIntoClient` variant of the function. Resolves rdar://121344690
22 lines
605 B
Swift
22 lines
605 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift -module-name main -Xfrontend -unavailable-decl-optimization=stub %s -o %t/a.out
|
|
// RUN: %target-codesign %t/a.out
|
|
// RUN: %target-run %t/a.out > %t/output 2>&1 || true
|
|
// RUN: %FileCheck %s < %t/output
|
|
|
|
// REQUIRES: executable_test
|
|
|
|
@available(*, unavailable)
|
|
public func foo() {
|
|
print("Can't call this")
|
|
}
|
|
|
|
// To bypass the typechecker, forward declare an available function with the
|
|
// same mangling as foo.
|
|
@_silgen_name("$s4main3fooyyF")
|
|
func callFoo()
|
|
|
|
// CHECK: Fatal error: Unavailable code reached
|
|
// CHECK-NOT: Can't call this
|
|
callFoo()
|