Files
swift-mirror/test/attr/attr_c_async.swift
Allan Shortlidge c03ba38ba5 test: Rename tests for the @c attribute.
The accepted spelling of the official attribute is `@c`. In the fullness of
time, it would be confusing that tests for `@c` refer to the old spelling
(`@_cdecl`).
2026-07-01 07:52:53 -07:00

16 lines
621 B
Swift

// RUN: %target-typecheck-verify-swift -enable-objc-interop \
// RUN: -disable-availability-checking
// REQUIRES: concurrency
@_cdecl("async") // expected-error{{@_cdecl global function cannot be asynchronous}}
func asynchronous() async { }
@c(async2) // expected-error{{@c global function cannot be asynchronous}}
func asynchronous2() async { }
@c(asyncParam)
func asynchronousParam(fn: (String) async -> Int) { }
// expected-error @-1 {{global function cannot be marked '@c' because the type of the parameter cannot be represented in C}}
// expected-note @-2 {{'async' function types cannot be represented in C}}