Skip to content

Commit aa9721d

Browse files
committed
Fix IsUserOperatorCall for friend operators
1 parent b56abf7 commit aa9721d

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎cpp2rust/converter/converter_lib.cpp‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -908,9 +908,12 @@ bool IsUserOperatorCall(const clang::CXXOperatorCallExpr *expr) {
908908
if (!callee) {
909909
return false;
910910
}
911-
if (const auto *method = clang::dyn_cast<clang::CXXMethodDecl>(callee);
912-
method && method->isDefaulted() && IsComparisonOperator(method)) {
913-
return IsUserDefinedDecl(method->getParent());
911+
if (callee->isDefaulted() && IsComparisonOperator(callee)) {
912+
const clang::Decl *owner = callee;
913+
if (const auto *method = clang::dyn_cast<clang::CXXMethodDecl>(callee)) {
914+
owner = method->getParent();
915+
}
916+
return IsUserDefinedDecl(owner);
914917
}
915918
if (const auto *method = clang::dyn_cast<clang::CXXMethodDecl>(callee);
916919
method && IsConvertibleMoveAssignment(method)) {

0 commit comments

Comments
 (0)