-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
noexcept
not supported and can mess up subclasses
#1435
Comments
Thanks for the report - please could you submit a PR with a test case to |
Sure, I added a failing test case in #1436. |
Thanks for that - it helped me get to looking at this a lot sooner than I otherwise would have done. Here's what it would take to fix this. I'm not going to do this any time soon, but perhaps this will help others who want to do it sooner. The first (main) problem is that bindgen does not inform autocxx about the We would then presumably get this information in a Overall the thing to do is to wait a couple of weeks for the PRs in #124 to be reviewed, and for us to move closer to an upstream bindgen, and then see how easy it would be to add this information. |
noexcept
not supported and can mess up subclasses
Describe the bug
When defining a virtual noexcept method in a C++ class that is derived using
#[subclass(superclass("MyCppClass"))]
, the generated wrapper methods do not include thenoexcept
statement, leading to a compiler error due to looser exception statement.To Reproduce
Expected behavior
Print statement is executed of
doSomething
call, which is done if thenoexcept
is removed from the virtual method.Additional context
Error:
cargo:warning=In file included from /home/XXX/autocxx-bugs/noexcept/target/debug/build/noexcept-568b2dad4acfbf95/out/autocxx-build-dir/cxx/gen0.cxx:2: cargo:warning=/home/XXX/autocxx-bugs/noexcept/target/debug/build/noexcept-568b2dad4acfbf95/out/autocxx-build-dir/include/autocxxgen_ffi.h:41:6: error: looser exception specification on overriding virtual function 'virtual void DerivedStructCpp::doSomething() const' cargo:warning= 41 | void doSomething() const; cargo:warning= | ^~~~~~~~~~~ cargo:warning=In file included from /home/XXX/autocxx-bugs/noexcept/target/debug/build/noexcept-568b2dad4acfbf95/out/autocxx-build-dir/cxx/gen0.cxx:1: cargo:warning=./src/code.hpp:5:18: note: overridden function is 'virtual void SuperClass::doSomething() const noexcept' cargo:warning= 5 | virtual void doSomething() const noexcept = 0;
I belive it should be rather straightforward to also pass the noexcept to the generated code by autocxx / cxx.
In the generated C++ code, the noexcept is missing:
The text was updated successfully, but these errors were encountered: