Issue |
153592
|
Summary |
[LifetimeSafety] Two loans created from the same _expression_
|
Labels |
clang:temporal-safety
|
Assignees |
|
Reporter |
usx95
|
```cpp
#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
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs