`shared_ptr<const int>` leads to C++ code that doesn't compile
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.6k
- Forks
- 175
- PR merge metrics
- No merged PRs in 30d
Description
Expected Behavior
Emit bindings that work. dtolnay/cxx#1006 says that inserting a typedef results in cxx::bridge handling it already. dtolnay/cxx#850 talks about making it easier.
dtolnay/cxx#537 and dtolnay/cxx#885 have some discussions around making this type more useful, but that seems like a secondary problem.
Actual Behavior
C++ code with shared_ptr<const int> produces generated C++ that doesn't compile because it tries using shared_ptr<int>. It looks like bindgen is stripping out the necessary information before autocxx has a chance to do anything about it :(.
Steps to Reproduce the Problem
#800 has a test case with int.
Opaque C++ types might need to be handled differently. My code actually uses absl::Span, which might have other issues that require a hand-written intermediate typedef regardless.
Specifications
- Version: 90c2aa19c131c66ab96d4962157c3afe2c87fcb1
- Platform: Linux
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the test case referenced in issue #800, then trace how bindgen represents shared_ptr before autocxx generates C++. Done means the generated bindings preserve the const-qualified pointee and the resulting C++ compiles; check the opaque-type behavior separately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100