autocxx icon indicating copy to clipboard operation
autocxx copied to clipboard

Expected a pinned reference: WasNotPin

Open boydjohnson opened this issue 2 years ago • 2 comments

c++ header

namespace mapnik {
class Map {
public:
  int &a(long);
};
} // namespace mapnik
thread 'main' panicked at 'Expected a pinned reference: WasNotPin', /home/boydjohnson/.cargo/registry/src/github.com-1ecc6299db9ec823/autocxx-engine-0.22.3/src/conversion/codegen_rs/lifetime.rs:103:33

Expected Behavior

autocxx-gen produces the c++ side of the bridge.

Actual Behavior

autocxx-bindgen produces

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct mapnik_Map {
    pub _address: u8,
}
extern "C" {
    #[link_name = "\u{1}_ZN6mapnik3Map1aEl"]
    pub fn mapnik_Map_a(
        this: *mut mapnik_Map,
        arg1: ::std::os::raw::c_long,
    ) -> *mut ::std::os::raw::c_int;
}
impl mapnik_Map {
    #[inline]
    pub unsafe fn a(&mut self, arg1: ::std::os::raw::c_long) -> *mut ::std::os::raw::c_int {
        mapnik_Map_a(self, arg1)
    }
}

but autocxx-gen fails with the above panic.

Specifications

  • Version: 0.22.3
  • Platform: ubuntu

Let me know if this is a bad issue/not a bug/bug in my understanding of C++.

boydjohnson avatar Aug 04 '22 14:08 boydjohnson

Thanks, this is definitely a bug in autocxx. Would you mind raising a PR with a failing test case?

adetaylor avatar Aug 04 '22 14:08 adetaylor

Yeah, I'll do so.

boydjohnson avatar Aug 04 '22 14:08 boydjohnson

Sorry for the delay on this. This is next on my list of bugs to take a look at.

adetaylor avatar Sep 11 '22 19:09 adetaylor

No problem. Thanks for all your work, @adetaylor

boydjohnson avatar Sep 11 '22 23:09 boydjohnson