From 2e8430026761431cfab37d1504f29e6ef3473ecd Mon Sep 17 00:00:00 2001 From: Adrian Taylor Date: Mon, 11 Sep 2023 15:19:44 -0700 Subject: [PATCH] Test for #1328. --- integration-tests/tests/integration_test.rs | 52 +++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/integration-tests/tests/integration_test.rs b/integration-tests/tests/integration_test.rs index 7c2cccfe2..d72c5739d 100644 --- a/integration-tests/tests/integration_test.rs +++ b/integration-tests/tests/integration_test.rs @@ -7771,6 +7771,58 @@ fn test_pv_subclass_ptr_param() { ); } +#[test] +fn test_pv_subclass_opaque_param() { + let hdr = indoc! {" + #include + + typedef uint32_t MyUnsupportedType[4]; + + struct MySupportedType { + uint32_t a; + }; + + class MySuperType { + public: + virtual void foo(const MyUnsupportedType* foo, const MySupportedType* bar) const = 0; + virtual ~MySuperType() = default; + }; + "}; + run_test_ex( + "", + hdr, + quote! { + MySubType::new_rust_owned(MySubType { a: 3, cpp_peer: Default::default() }); + }, + quote! { + subclass!("MySuperType",MySubType) + extern_cpp_opaque_type!("MyUnsupportedType", crate::ffi2::MyUnsupportedType) + }, + None, + None, + Some(quote! { + + #[cxx::bridge] + pub mod ffi2 { + unsafe extern "C++" { + include!("input.h"); + type MyUnsupportedType; + } + } + use autocxx::subclass::CppSubclass; + use ffi::MySuperType_methods; + #[autocxx::subclass::subclass] + pub struct MySubType { + a: u32 + } + impl MySuperType_methods for MySubType { + unsafe fn foo(&self, _foo: *const ffi2::MyUnsupportedType, _bar: *const ffi::MySupportedType) { + } + } + }), + ); +} + #[test] fn test_pv_subclass_return() { let hdr = indoc! {"