[llvm-branch-commits] [clang] [LifetimeSafety] Detect use-after-invalidation for STL containers (PR #179093)

Gábor Horváth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 3 02:48:56 PST 2026


================
@@ -39,12 +39,17 @@ struct AccessPath {
   //   temporary object materialized via this MaterializeTemporaryExpr.
   const llvm::PointerUnion<const clang::ValueDecl *,
                            const clang::MaterializeTemporaryExpr *>
-      P;
+      P = nullptr;
 
 public:
+  AccessPath() {};
----------------
Xazax-hun wrote:

Why was this default constructor introduced? I would not want to make this type nullable unless we have a strong reason. We could consider having an `std::optional<AccessPath>` if the need for nullability is local. 

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


More information about the llvm-branch-commits mailing list