mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
inside function returning it
A stack overflow would happen when the compiler tried emitting debug
info for a function whose opaque return type was declared inside the
function itself. This fixes the issue by emitting a forward declaration
for the function before emitting it.
rdar://150313956
(cherry picked from commit c03831f70d)
15 lines
396 B
Swift
15 lines
396 B
Swift
// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
|
|
|
|
protocol TheProtocol {
|
|
}
|
|
|
|
// CHECK: ![[FUNC_ID:[0-9]+]] = distinct !DISubprogram(name: "theFunction",
|
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "TheType", scope: ![[FUNC_ID]]
|
|
func theFunction() -> some TheProtocol {
|
|
struct TheType: TheProtocol {
|
|
}
|
|
return TheType()
|
|
}
|
|
|
|
theFunction()
|