================
@@ -319,6 +319,204 @@ void test_fp_ops_fail(struct FPOps *ops) {
ops->requires_mu(); // expected-warning {{calling function 'requires_mu'
requires holding mutex '&FPOps::mu' exclusively}}
}
+// An attribute on a member of an anonymous struct/union may name a field of
+// the enclosing record, and vice versa.
+struct AnonMembers {
+ struct Mutex mu;
+ union {
+ int a GUARDED_BY(mu);
+ };
+ struct {
+ struct Mutex inner;
+ int c GUARDED_BY(inner);
+ struct Also {
+ int az GUARDED_BY(inner);
----------------
aaronpuchert wrote:
We shouldn't allow this. Named structs can be instantiated outside of their
scope, and then it's unclear what this refers to. In general we can't point to
a parent object, but in case of anonymous types we at least know that one
exists. See also the discussion on #78131.
https://github.com/llvm/llvm-project/pull/233965
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits