Skip to content

Commit fd63387

Browse files
authored
Merge pull request #69885 from kubamracek/embedded-opaque
[embedded] Avoid compiler crash when using an opaque result type
2 parents 55b82e9 + 494e87e commit fd63387

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/IRGen/GenStruct.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,6 +1636,9 @@ void IRGenModule::emitStructDecl(StructDecl *st) {
16361636
}
16371637

16381638
void IRGenModule::maybeEmitOpaqueTypeDecl(OpaqueTypeDecl *opaque) {
1639+
if (opaque->getASTContext().LangOpts.hasFeature(Feature::Embedded))
1640+
return;
1641+
16391642
if (!opaque->isAvailableDuringLowering())
16401643
return;
16411644

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %target-swift-emit-ir %s -target %target-cpu-apple-macos14 -enable-experimental-feature Embedded | %FileCheck %s
2+
3+
// REQUIRES: swift_in_compiler
4+
// REQUIRES: VENDOR=apple
5+
// REQUIRES: OS=macosx
6+
7+
protocol Proto { }
8+
9+
struct MyStruct: Proto { }
10+
11+
func foo() -> some Proto {
12+
MyStruct()
13+
}
14+
15+
// CHECK: define {{.*}}@main(

0 commit comments

Comments
 (0)