[clang] [clang] Diagnose dangling issues for the "Container<GSLPointer>" case. (PR #107213)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 12:27:01 PDT 2024


================
@@ -990,13 +1009,16 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
         //   int &p = *localUniquePtr;
         //   someContainer.add(std::move(localUniquePtr));
         //   return p;
-        IsLocalGslOwner = isRecordWithAttr<OwnerAttr>(L->getType());
+        IsLocalGslOwner =
+            isRecordWithAttr<OwnerAttr>(L->getType()) &&
+            !isContainerOfPointer(L->getType()->getAsRecordDecl());
----------------
hokein wrote:

Done.

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


More information about the cfe-commits mailing list