[libcxx] [lldb] [flang] [clang] [libc] [llvm] [compiler-rt] [clang] Fix assertion failure with deleted overloaded unary operators (PR #78316)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 06:12:48 PST 2024


================
@@ -14306,12 +14306,17 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
     return ExprError();
 
   case OR_Deleted:
+    // CreateOverloadedUnaryOp fills first element of ArgsArray with the object
+    // whose method was called. Later in NoteCandidates size of ArgsArray is
+    // passed further and it eventually ends up compared to number of function
+    // candidate parameters which never includes implicit object parameter, so
+    // do a slice to ArgsArray to make sure apples are compared to apples.
----------------
cor3ntin wrote:

```suggestion
    // CreateOverloadedUnaryOp fills the first element of ArgsArray with the object
    // whose method was called. Later in NoteCandidates size of ArgsArray is
    // passed further and it eventually ends up compared to number of function
    // candidate parameters which never includes the implicit object parameter, so
    // slice ArgsArray to make sure apples are compared to apples.
```

https://github.com/llvm/llvm-project/pull/78316


More information about the cfe-commits mailing list