[clang] [clang] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 18 01:02:26 PDT 2024
================
@@ -34,6 +34,6 @@ struct basic_string {
};
} // namespace std
void test(const char* a) {
- // verify we're emitting the `-Wdangling-assignment` warning.
+ // verify we're emitting the `-Wdangling-assignment-gsl` warning.
a = std::basic_string().c_str(); // expected-warning {{object backing the pointer a will be destroyed at the end of the full-expression}}
----------------
hokein wrote:
The warning is triggered by the implicit `gsl::Owner` attribute on `std::basic_string`. Without this attribute, the warning would not be issued.
https://github.com/llvm/llvm-project/pull/99032
More information about the cfe-commits
mailing list