You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If clang-sys is compiled to target clang_3_5 but is linked against libclang 3.9 a crash (SIGSEGV or stack overflow) occurs when libclang returns an enum variant unknown to clang-sys that is then used in a match expression.
I filed a "bug" with rust-lang although it seems this is intended behavior for rust. Possible solutions are to cast the enums to an int or use int constants instead to avoid this problem, perhaps re-wrapping them as an enum. rust-lang/rust#36927
Well, this is a problem. It also made me think of a related problem. If you are using libclang 3.9 (but compiled for libclang 3.5) and ask for the CXCallingConv of a function with the Swift calling convention (added in 3.9), what should be returned? libclang 3.5 doesn't know what Swift is, so should it panic? Return CXCallingConv::Default? I'll need to think about this.
If clang-sys is compiled to target clang_3_5 but is linked against libclang 3.9 a crash (SIGSEGV or stack overflow) occurs when libclang returns an enum variant unknown to clang-sys that is then used in a match expression.
I filed a "bug" with rust-lang although it seems this is intended behavior for rust. Possible solutions are to cast the enums to an int or use int constants instead to avoid this problem, perhaps re-wrapping them as an enum. rust-lang/rust#36927
Some other discussions of this issue:
https://internals.rust-lang.org/t/c-style-enums-in-ffi-and-a-proposal-to-lump-in-with-unions/2744
https://users.rust-lang.org/t/backward-compatibility-of-enums/5224
rust-lang/rfcs#757
The text was updated successfully, but these errors were encountered: