================
@@ -2531,3 +2531,51 @@ int *noreturn_dead_nested(bool cond, bool cond2, int 
*num) {
 }
 
 } // namespace conditional_operator_control_flow
+
+namespace method_call_uses_field_origins {
+int val;
+std::string GLOBAL{"123"};
+
+struct S {
+public:
+  int* p_;
+  void bar();
+  void foo() {
+    {
+      int num;
+      this->p_ = # // expected-warning {{object whose reference is 
captured does not live long enough}}
+    }                  // expected-note {{destroyed here}}
+    bar();             // expected-note {{later used here}}
+    this->p_ = &val;
----------------
usx95 wrote:

can you add a test where `p` is "saved" like this before the call to `bar`. 
This should not have the diagnostic.

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

Reply via email to