================
@@ -1103,6 +1094,8 @@ shouldLifetimeExtendThroughPath(const IndirectLocalPath
&Path) {
for (auto Elem : Path) {
if (Elem.Kind == IndirectLocalPathEntry::DefaultInit)
return PathLifetimeKind::Extend;
+ if (Elem.Kind == IndirectLocalPathEntry::MemberExpr)
+ continue;
----------------
hokein wrote:
This is necessary for the standard lifetime extension case. Since we add a new
`MemberExpr` to the path, we need to skip it to maintain the existing behavior;
otherwise, cases like `const int &x = A().i;` would incorrectly trigger
diagnostics.
The case `const Bar& bar = foo.v.back();` is already handled on Line 1186.
https://github.com/llvm/llvm-project/pull/122088
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits