Skip to content

Commit 49d4ca8

Browse files
committed
Translate default of void as unit type
1 parent ae251a8 commit 49d4ca8

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎cpp2rust/converter/converter.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3998,6 +3998,10 @@ std::string Converter::GetArrayDefaultAsString(clang::QualType qual_type) {
39983998
}
39993999

40004000
std::string Converter::GetDefaultAsString(clang::QualType qual_type) {
4001+
if (qual_type->isVoidType()) {
4002+
return "()";
4003+
}
4004+
40014005
if (IsVaListType(qual_type)) {
40024006
computed_expr_type_ = ComputedExprType::FreshValue;
40034007
return "VaList::default()";

‎tests/unit/out/unsafe/forward_pack.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub unsafe fn chosen_overload_3(_a0: *mut i32) -> Overload {
6464
}
6565
pub unsafe fn forward_pack_4() -> i32 {
6666
let mut digits: i32 = 0;
67-
<::libc::c_void>::default();
67+
();
6868
return digits;
6969
}
7070
pub unsafe fn forward_pack_5(args: *mut Tracked) -> i32 {

0 commit comments

Comments
 (0)