Why does my code using macros get EXC_BAD_ACCESS but the expanded code is fine?

I have a macro, it also opensourced on github, this is the repository that used to convert a data model to a persistent document, and save the document (plist) in to disk. But I met some probem when I use this macro, it will cause EXC_BAD_ACCESS, but if I use the expanded code directly, it works very well. I don't understand why.

I wrote a unit test in the repository and mark those two test.

Which exact version of Swift are you using to reproduce it, which platform and version of that platform? If that's Linux, please also specify the distribution and its exact version of that. Thanks!

I use Swift 5.9 which run in macOS 14.2.

Is this reproducible with Swift 5.9.2 or latest 5.10/main development snapshots?

I use the releases version for sure.

Would greatly appreciate you filing an issue at Issues · apple/swift · GitHub with all the repro steps and exact versions, and then repost a link to that new issue here, if possible. That would allow us to track it and collect relevant information in one place.

I create the issue now, it in App using Swift macros unexpectedly report EXC_BAD_ACCESS errors. · Issue #70469 · apple/swift · GitHub.