Skip to content

Commit 6e5702b

Browse files
authored
Merge pull request swiftlang#76167 from swiftlang/gaborh/indirect-enum-case
[cxx-interop] Do not export enums with indirect associated values
2 parents 96b14a7 + 0eab959 commit 6e5702b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/AST/SwiftNameTranslation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ swift::cxx_translation::getDeclRepresentation(const ValueDecl *VD) {
264264
for (const auto *elementDecl : enumCase->getElements()) {
265265
if (!elementDecl->hasAssociatedValues())
266266
continue;
267+
if (elementDecl->isIndirect())
268+
return {Unsupported, UnrepresentableIndirectEnum};
267269
// Do not expose any enums with > 1
268270
// enum parameter, or any enum parameter
269271
// whose type we do not yet support.

test/Interop/SwiftToCxx/enums/swift-enum-implementation.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ public enum E2 {
3333
case baz
3434
}
3535

36+
public enum Expr {
37+
case Const(Int)
38+
indirect case Neg(Expr)
39+
}
40+
3641
public struct S {
3742
public var x: Int64
3843

0 commit comments

Comments
 (0)