================
@@ -1042,9 +1069,12 @@ void
operator_star_arrow_of_iterators_false_positive_no_cfg_analysis() {
const std::string& r = (*v.begin()).second;
auto temporary = []() { return std::vector<std::pair<int, std::string>>{{1,
"1"}}; };
- const char* x = temporary().begin()->second.data(); // cfg-warning {{local
temporary object does not live long enough}} cfg-note {{destroyed here}}
- const char* y = (*temporary().begin()).second.data(); // cfg-warning {{local
temporary object does not live long enough}} cfg-note {{destroyed here}}
- const std::string& z = (*temporary().begin()).second; // cfg-warning {{local
temporary object does not live long enough}} cfg-note {{destroyed here}}
+ const char* x = temporary().begin()->second.data(); // cfg-warning {{local
temporary object does not live long enough}} cfg-note {{destroyed here}} \
+ // cfg-note 4
{{expression aliases the storage of local temporary object}}
----------------
usx95 wrote:
nit: Can you add this example in the PR description.
https://github.com/llvm/llvm-project/pull/199345
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits