[clang] [clang] Diagnose dangling issues for the "Container<GSLPointer>" case. (PR #107213)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 5 01:17:17 PDT 2024


================
@@ -499,3 +518,28 @@ std::string_view test2(int i, std::optional<std::string_view> a) {
   return std::move(a.value());
 }
 }
+
+namespace GH100526 {
+void test() {
+  std::vector<std::string_view> t1 = {std::string()}; // expected-warning {{object backing the pointer will be destroyed at the end}}
----------------
usx95 wrote:

Great. Thanks.

https://github.com/llvm/llvm-project/pull/107213


More information about the cfe-commits mailing list