-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Open
Labels
clang:temporal-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)
Description
#include <string>
void foo() {
std::string a;
const std::string* p = {&a};
const std::string* q = p;
}
https://godbolt.org/z/b4nKKGccE
Debug output:
[B2 (ENTRY)]
Succs (1): B1
[B1]
1: (CXXConstructExpr, std::string)
2: std::string a;
3: a
4: &[B1.3]
5: [B1.4] (ImplicitCastExpr, NoOp, const std::string *)
6: const std::string *p = {&a};
7: p
8: [B1.7] (ImplicitCastExpr, LValueToRValue, const std::string *)
9: const std::string *q = p;
10: [B1.2].~std::string() (Implicit destructor)
Preds (1): B2
Succs (1): B0
[B0 (EXIT)]
Preds (1): B1
==========================================
Lifetime Analysis Facts:
==========================================
Function: foo
Block B2:
End of Block
Block B1:
Issue (LoanID: 0, OriginID: 0)
Issue (LoanID: 1, OriginID: 0)
AssignOrigin (DestID: 1, SrcID: 0)
AssignOrigin (DestID: 2, SrcID: 3)
AssignOrigin (DestID: 4, SrcID: 2)
AssignOrigin (DestID: 5, SrcID: 4)
Expire (LoanID: 0)
Expire (LoanID: 1)
End of Block
Block B0:
End of Block
Metadata
Metadata
Assignees
Labels
clang:temporal-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)
Type
Projects
Status
No status