================
@@ -601,17 +601,23 @@ void test() {
   std::optional<std::string_view> o4 = std::optional<std::string_view>(s); 
 
   // FIXME: should work for assignment cases
-  v1 = {std::string()};
-  o1 = std::string();
+  v1 = {std::string()}; // expected-warning {{object backing the pointer}}
+  o1 = std::string(); // expected-warning {{object backing the pointer}}
 
   // no warning on copying pointers.
   std::vector<std::string_view> n1 = {std::string_view()};
+  n1 = {std::string_view()};
----------------
Xazax-hun wrote:

Not strictly related to this PR, but we could add some tests for more deeply 
nested containers like `std::vector<std::vector<std::string_view>>`. Regardless 
if we gat warnings for those or not, documenting whether this case works in 
tests have some value. 

https://github.com/llvm/llvm-project/pull/108205
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to