Skip to content

Conversation

susmonteiro
Copy link
Contributor

@susmonteiro susmonteiro requested a review from a team as a code owner September 4, 2025 14:13
@susmonteiro susmonteiro added c++ interop Feature: Interoperability with C++ 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2 labels Sep 4, 2025
@susmonteiro
Copy link
Contributor Author

@swift-ci please test

@susmonteiro susmonteiro marked this pull request as draft September 4, 2025 14:20
@susmonteiro susmonteiro force-pushed the 6.2-nonescapable-std-optional branch from 7eadbd4 to a02374a Compare September 4, 2025 14:54
…nescapable

When we tried to create a std::optional of a nonescapable type in Swift, the compiler would run into an assertion failure.
This is because std::optional has an anonymous union where one of its members would be of this nonescapable type.

Turns out that we were not handling anonymous unions with nonescapable members correctly.
Fields of anonymous unions are injected to the parent as IndirectFieldDecl, so we need to handle these indirect fields the same way we handle "normal" fields.

rdar://156704699
@susmonteiro susmonteiro force-pushed the 6.2-nonescapable-std-optional branch from a02374a to 29e5549 Compare September 4, 2025 15:21
@susmonteiro susmonteiro marked this pull request as ready for review September 4, 2025 15:22
@susmonteiro
Copy link
Contributor Author

@swift-ci please test

@susmonteiro susmonteiro merged commit f592747 into swiftlang:release/6.2 Sep 4, 2025
5 checks passed
@susmonteiro susmonteiro deleted the 6.2-nonescapable-std-optional branch September 30, 2025 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ interop Feature: Interoperability with C++ 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants