mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When Swift imports C structs, it synthesizes an initializer that takes no arguments and zero-initializes the C struct. When C++ interop is enabled, Clang treats all C structs as if they were C++ structs. This means that some of the C structs will get a default constructor implicitly generated by Clang. This implicit default constructor will not zero-initialize trivial fields of the struct. This is a common source of confusion and subtle bugs for developers who try to enable C++ interop in existing projects that use C interop and rely on zero-initialization of C structs. rdar://115909532
2.7 KiB
2.7 KiB