================
@@ -4944,6 +4949,14 @@ class Foo {
     (*datap2_)[0] = 0;    // expected-warning {{reading the value pointed to 
by 'datap2_' requires holding mutex 'mu_'}}
 
     data_();              // expected-warning {{reading variable 'data_' 
requires holding mutex 'mu_'}}
+
+    // Calls operator&, and does not take the address.
+    (void)&data_ao_;      // expected-warning {{reading variable 'data_ao_' 
requires holding mutex 'mu_'}}
+    (void)__builtin_addressof(data_ao_); // expected-warning {{passing 
variable 'data_ao_' by reference requires holding mutex 'mu_'}}
+    showData(&data_ao_);  // expected-warning {{reading variable 'data_ao_' 
requires holding mutex 'mu_'}}
+    (void)&data_;         // no warning
+    (void)datap2_;        // no warning
+    showData(&data_);     // expected-warning {{passing pointer to variable 
'data_' requires holding mutex 'mu_'}}
----------------
aaronpuchert wrote:

This doesn't belong here, because we're not calling overloaded operators in 
these cases.

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

Reply via email to