Skip to content

Commit 4ec89bd

Browse files
committed
Handle Ptr to array in union accessor
1 parent 9c2f898 commit 4ec89bd

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

cpp2rust/converter/models/converter_refcount.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,13 @@ void ConverterRefCount::EmitRustUnion(clang::RecordDecl *decl) {
503503
{
504504
PushBrace impl_brace(*this);
505505
for (auto *field : decl->fields()) {
506+
PushConversionKind push(*this, ConversionKind::FullRefCount);
507+
std::string storage_ty = ToString(field->getType());
508+
Unwrap(storage_ty, "Value<", ">");
506509
StrCat(std::format(
507510
"pub fn {}(&self) -> Ptr<{}> {{ (self.__bytes.as_pointer() "
508511
"as Ptr<u8>).reinterpret_cast() }}",
509-
GetNamedDeclAsString(field), Mapper::Map(field->getType())));
512+
GetNamedDeclAsString(field), storage_ty));
510513
}
511514
}
512515

0 commit comments

Comments
 (0)