autocxx
autocxx copied to clipboard
C++ methods with reference qualifiers result in non-compiling wrappers
Expected Behavior
Either ignore them or generate usable wrappers. I don't see a problem with ref-qualified methods, but rvalue-ref-qualified ones should probably be ignored because there's no good Rust analog for them.
Actual Behavior
C++ wrappers don't compile.
Specifically, it fails because it drops the ref-qualifier in the pointer-to-member-function type:
cargo:warning=/tmp/.tmpZHzT1q/target/cxx/gen0.cxx: In function ‘void cxxbridge1$A$foo(A&)’:
cargo:warning=/tmp/.tmpZHzT1q/target/cxx/gen0.cxx:137:31: error: cannot convert ‘void (A::*)() &’ to ‘void (A::*)()’ in initialization
cargo:warning= void (::A::*foo$)() = &::A::foo;
Even if they did, I think overeager std::move
in the wrappers will call rvalue-ref-qualified methods on C++ objects which are not being destroyed soon.
Probably a low priority. I've never seen C++ code which actually uses these, I just thought about it while thinking about all the kinds of special member functions.
PR with an ignored failing test incoming.
Next steps here: try to spot these cases and ignore them. Adding good-first-bug label since that may be straightforward, depending on the information we're given here by bindgen.