[clang] [clang] Respect the lifetimebound in assignment operator. (PR #106997)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 3 02:35:08 PDT 2024


================
@@ -968,6 +972,23 @@ static bool pathOnlyHandlesGslPointer(IndirectLocalPath &Path) {
   return false;
 }
 
+static bool isAssginmentOperatorLifetimeBound(CXXMethodDecl *CMD) {
+  if (!CMD)
+    return false;
+  assert(CMD->getOverloadedOperator() == OverloadedOperatorKind::OO_Equal);
----------------
hokein wrote:

It is impossible to hit compound assignment operator for the current implementation, we only set the  `AssignedEntity::AssignmentOperator` for the `OO_Equal` case (see the `clang/lib/Sema/SemaOverload.cpp`)

It is possible/trivial to support them, but I don't have plan to do it (I guess they should be rare in practice).

To avoid the confusion, I think we can just drop this assertion.

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


More information about the cfe-commits mailing list