Skip to content

Commit 05258a5

Browse files
authored
Use PushParen in global array decay emission
1 parent 167627e commit 05258a5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

cpp2rust/converter/converter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,9 +1987,10 @@ bool Converter::VisitImplicitCastExpr(clang::ImplicitCastExpr *expr) {
19871987
break;
19881988
}
19891989
if (IsGlobalVar(sub_expr)) {
1990-
StrCat("(&raw", dest_pointee_const ? keyword::kConst : keyword_mut_);
1990+
PushParen paren(*this);
1991+
StrCat("&raw", dest_pointee_const ? keyword::kConst : keyword_mut_);
19911992
Convert(sub_expr);
1992-
StrCat(").cast::<",
1993+
StrCat(".cast::<",
19931994
GetUnsafeTypeAsString(expr->getType()->getPointeeType()), ">()");
19941995
} else {
19951996
Convert(sub_expr);

0 commit comments

Comments
 (0)