[clang-tools-extra] [clang-tidy] Fix false positive in readability-make-member-function-c… (PR #174286)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 17 07:21:42 PST 2026


================
@@ -336,3 +336,53 @@ struct MemberFunctionPointer {
 };
 
 } // namespace Keep
+
+namespace UnionMemberAccess {
+  // Test case from GitHub issue #174269
+  // Union with pointer member returning non-const reference
+  struct UnionWithPointer {
+    union { int* resource; };
+    int& get() { return *resource; }  // Should NOT trigger warning
----------------
vbvictor wrote:

Please remove all 
`// Should NOT trigger warning`

It is expected by default to not trigger warning

https://github.com/llvm/llvm-project/pull/174286


More information about the cfe-commits mailing list