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
35 lines
1.0 KiB
Swift
35 lines
1.0 KiB
Swift
// RUN: %swift -prespecialize-generic-metadata -target %module-target-future -parse-stdlib -emit-ir %s | %FileCheck %s -DINT=i%target-ptrsize -DALIGNMENT=%target-alignment
|
|
|
|
// REQUIRES: VENDOR=apple || OS=linux-gnu
|
|
// UNSUPPORTED: CPU=i386 && OS=ios
|
|
// UNSUPPORTED: CPU=armv7 && OS=ios
|
|
// UNSUPPORTED: CPU=armv7s && OS=ios
|
|
|
|
precedencegroup AssignmentPrecedence {}
|
|
|
|
class Namespace<T> {}
|
|
|
|
class Zang {
|
|
}
|
|
|
|
extension Namespace where T == Zang {
|
|
class ExtensionNonGeneric {}
|
|
}
|
|
|
|
@inline(never)
|
|
func consume<T>(_ t: T) {
|
|
Builtin.fixLifetime(t)
|
|
}
|
|
|
|
// CHECK: define hidden swiftcc void @"$s4main4doityyF"() #{{[0-9]+}} {
|
|
// CHECK: entry:
|
|
// CHECK: [[METADATA_RESPONSE:%[0-9]+]] = call swiftcc %swift.metadata_response @"$s4main9NamespaceCA2A4ZangCRszlE19ExtensionNonGenericCyAE_GMa"([[INT]] 0)
|
|
// CHECK: [[METADATA:%[0-9]+]] = extractvalue %swift.metadata_response [[METADATA_RESPONSE]], 0
|
|
// CHECK: call swiftcc void @"$s4main7consumeyyxlF"(ptr noalias {{%.*}}, ptr [[METADATA]])
|
|
// CHECK: }
|
|
func doit() {
|
|
consume( Namespace<Zang>.ExtensionNonGeneric() )
|
|
}
|
|
|
|
doit()
|