Open paulyoung opened 1 year ago
I just updated the repo to use generate!
instead of subclass!
since I figured that would be a more minimal example, even though my use case is subclassing.
The build now fails with:
cargo:warning=In file included from /Users/py/projects/paulyoung/autocxx-bug/main/target/debug/build/autocxx-bug-94a6f68b4aecae68/out/autocxx-build-dir/cxx/gen0.cxx:2:
cargo:warning=/Users/py/projects/paulyoung/autocxx-bug/main/target/debug/build/autocxx-bug-94a6f68b4aecae68/out/autocxx-build-dir/include/autocxxgen_ffi.h:43:148: error: no matching function for call to 'operator new'
cargo:warning=inline void new_synthetic_const_copy_ctor_0x42aaa771a89cc55d_autocxx_wrapper_0x42aaa771a89cc55d(MyClass* autocxx_gen_this, const MyClass& arg1) { new (autocxx_gen_this) MyClass(arg1); }
cargo:warning= ^ ~~~~~~~~~~~~~~~~~~
cargo:warning=include/MyClass.h:12:15: note: candidate function not viable: requires single argument 'size', but 2 arguments were provided
cargo:warning= static void* operator new( size_t size );
cargo:warning= ^
Here's a concrete real life example (attemping to use autocxx with Half-Life SDK) stevefan1999-personal/autocxx-bug-operator-new (github.com)
I just updated the repo to use
generate!
instead ofsubclass!
since I figured that would be a more minimal example, even though my use case is subclassing.The build now fails with:
cargo:warning=In file included from /Users/py/projects/paulyoung/autocxx-bug/main/target/debug/build/autocxx-bug-94a6f68b4aecae68/out/autocxx-build-dir/cxx/gen0.cxx:2: cargo:warning=/Users/py/projects/paulyoung/autocxx-bug/main/target/debug/build/autocxx-bug-94a6f68b4aecae68/out/autocxx-build-dir/include/autocxxgen_ffi.h:43:148: error: no matching function for call to 'operator new' cargo:warning=inline void new_synthetic_const_copy_ctor_0x42aaa771a89cc55d_autocxx_wrapper_0x42aaa771a89cc55d(MyClass* autocxx_gen_this, const MyClass& arg1) { new (autocxx_gen_this) MyClass(arg1); } cargo:warning= ^ ~~~~~~~~~~~~~~~~~~ cargo:warning=include/MyClass.h:12:15: note: candidate function not viable: requires single argument 'size', but 2 arguments were provided cargo:warning= static void* operator new( size_t size ); cargo:warning= ^
Hi @paulyoung , did you manage to solve this in the end? I'm also running into this issue.
@pevers I didn't.
I thought about trying to fix the issue and submitting a PR or writing something by hand instead but my project is fairly low priority so I haven't invested any more time into it.
I might at least add some failing test cases.
Describe the bug The build fails with the following:
To Reproduce Try to build the project at https://github.com/paulyoung/autocxx-bug
Expected behavior Codegen results in code supplying the correct number of arguments.
Additional context In reality I don't control the header files so any potential workarounds would preferably not involve modifying them.