================
@@ -245,7 +245,8 @@ std::string_view containerWithAnnotatedElements() {
use(c1); // cfg-note {{later
used here}}
c1 = std::vector<std::string>().at(0); // expected-warning {{object backing
the pointer}} \
- // cfg-warning {{local temporary
object does not live long enough}} cfg-note {{destroyed here}}
+ // cfg-warning {{local temporary
object does not live long enough}} cfg-note {{destroyed here}} \
+ // cfg-note {{local temporary object
aliases the storage of local temporary object}}
----------------
suoyuan666 wrote:
Since we still have the source range output, I don't think it's entirely
useless. Although having both sides shown as local temporary object does indeed
look somewhat unclear...
```txt
multi-tmp.cpp:10:8: warning: object whose reference is captured does not live
long enough [-Wlifetime-safety-use-after-scope]
10 | c1 = std::vector<std::string>().at(0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
multi-tmp.cpp:10:33: note: destroyed here
10 | c1 = std::vector<std::string>().at(0);
| ^
multi-tmp.cpp:10:8: note: local temporary object aliases the storage of local
temporary object
10 | c1 = std::vector<std::string>().at(0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
multi-tmp.cpp:11:7: note: later used here
11 | use(c1);
```
https://github.com/llvm/llvm-project/pull/199345
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits