================
@@ -285,14 +421,31 @@ void use_container() {
   vector_of_string.push_back(std::string()); // Ok.
   
   MyVector<std::string_view> vector_of_view;
-  vector_of_view.push_back(std::string()); // expected-warning {{object whose 
reference is captured by 'vector_of_view' will be destroyed at the end of the 
full-expression}}
-  vector_of_view.push_back(getLifetimeBoundView(std::string())); // 
expected-warning {{object whose reference is captured by 'vector_of_view' will 
be destroyed at the end of the full-expression}}
-  
+  vector_of_view.push_back(std::string()); // expected-warning {{object whose 
reference is captured by 'vector_of_view' will be destroyed at the end of the 
full-expression}} \
+                                           // cfg-warning {{temporary object 
does not live long enough}} \
+                                           // cfg-note {{destroyed here}}
+  (void)vector_of_view;                    // cfg-note {{later used here}}
+  vector_of_view.push_back(getLifetimeBoundView(std::string())); // 
expected-warning {{object whose reference is captured by 'vector_of_view' will 
be destroyed at the end of the full-expression}} \
+                                                                 // 
cfg-warning {{temporary object does not live long enough}} \
+                                                                 // cfg-note 
{{destroyed here}} \
+                                                                 // cfg-note 
{{result of call to 'getLifetimeBoundView' aliases the storage of temporary 
object}}
+  (void)vector_of_view;                                          // cfg-note 
{{later used here}}
+
   MyVector<const std::string*> vector_of_pointer;
-  vector_of_pointer.push_back(getLifetimeBoundPointer(std::string())); // 
expected-warning {{object whose reference is captured by 'vector_of_pointer' 
will be destroyed at the end of the full-expression}}
-  
vector_of_pointer.push_back(getLifetimeBoundPointer(*getLifetimeBoundPointer(std::string())));
 // expected-warning {{object whose reference is captured by 
'vector_of_pointer' will be destroyed at the end of the full-expression}}
-  vector_of_pointer.push_back(getLifetimeBoundPointer(local));
-  vector_of_pointer.push_back(getNotLifetimeBoundPointer(std::string()));
+  vector_of_pointer.push_back(getLifetimeBoundPointer(std::string())); // 
expected-warning {{object whose reference is captured by 'vector_of_pointer' 
will be destroyed at the end of the full-expression}} \
+                                                                       // 
cfg-warning {{temporary object does not live long enough}} \
+                                                                       // 
cfg-note {{destroyed here}}
+  (void)vector_of_pointer;                                             // 
cfg-note {{later used here}}
+  
vector_of_pointer.push_back(getLifetimeBoundPointer(*getLifetimeBoundPointer(std::string())));
 // expected-warning {{object whose reference is captured by 
'vector_of_pointer' will be destroyed at the end of the full-expression}} \
+                                                                               
                  // cfg-warning {{temporary object does not live long enough}} 
\
+                                                                               
                  // cfg-note {{destroyed here}}
+  (void)vector_of_pointer;                                                     
                  // cfg-note {{later used here}}
+  vector_of_pointer.push_back(getLifetimeBoundPointer(local));              // 
cfg-warning {{temporary object does not live long enough}} \
+                                                                            // 
cfg-note {{destroyed here}}
+  (void)vector_of_pointer;                                                  // 
cfg-note {{later used here}}
+  vector_of_pointer.push_back(getNotLifetimeBoundPointer(std::string()));   // 
cfg-warning {{temporary object does not live long enough}} \
+                                                                            // 
cfg-note {{destroyed here}}
+  (void)vector_of_pointer;                                                  // 
cfg-note {{later used here}}
----------------
usx95 wrote:

This looks like a problematic false-positive. Can you look at and attach the 
AST here for reference.

https://github.com/llvm/llvm-project/pull/204361
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to