mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The use of 'nocapture' for parameters and return values is incorrect for C++ types, as they can actually capture a pointer into its own value (e.g. std::string in libstdc++) rdar://115062687
19 lines
973 B
Swift
19 lines
973 B
Swift
// RUN: %target-swift-frontend -emit-ir -primary-file %s | %FileCheck %s
|
|
|
|
// REQUIRES: PTRSIZE=64
|
|
|
|
// CHECK-LABEL: define hidden swiftcc void @"$s26variadic_generic_functions2f11tyxxQp_tRvzlF"(ptr noalias %0, i64 %1, ptr %"each T")
|
|
func f1<each T>(t: repeat each T) {}
|
|
|
|
// CHECK-LABEL: define hidden swiftcc void @"$s26variadic_generic_functions2f21t1uyxxQp_q_q_QptRvzRv_r0_lF"(ptr noalias %0, ptr noalias %1, i64 %2, i64 %3, ptr %"each T", ptr %"each U")
|
|
func f2<each T, each U>(t: repeat each T, u: repeat each U) {}
|
|
|
|
// CHECK-LABEL: define hidden swiftcc void @"$s26variadic_generic_functions2f31t1uyxxQp_q_xQptRvzRv_q_Rhzr0_lF"(ptr noalias %0, ptr noalias %1, i64 %2, ptr %"each T", ptr %"each U")
|
|
func f3<each T, each U>(t: repeat each T, u: repeat each U) where (repeat (each T, each U)): Any {}
|
|
|
|
protocol P {}
|
|
|
|
// CHECK-LABEL: define {{.*}}void @f4(ptr noalias %0, i64 %1, ptr %"each T", ptr %"each T.P")
|
|
@_silgen_name("f4")
|
|
func f4<each T : P>(t: repeat each T) {}
|