<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70139>70139</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
-Waddress-of-packed-member should also apply to references
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++,
clang:diagnostics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jroelofs
</td>
</tr>
</table>
<pre>
```
struct __attribute__((packed)) PackedStruct {
int a;
long long b;
};
int main() {
PackedStruct ps;
int *pa = &ps.a; // 1
long long *pb = &ps.b; // 2
int &ra = ps.a; // 3
long long &rb = ps.b; // 4
}
```
https://clang.godbolt.org/z/ePP9zzWWs
Clang currently warns on 1 and 2, but not 3 and 4.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsUk1vozAQ_TXDZRQE45DAgUPaiHOlPfQY-SvEXcdGttlV--tXhnabVJGswR7mvTfPHh6jGZ3WPTRP0BwLPqeLD_1b8Nr6cyyEV-897KrPVR2hOsQUZpnwdOIpBSPmpE8noBaonbj8rRVQB9Thy3L4tRbD_mkFIyIal5ADu8lY78Y1iP952B-_90vMuCs3bhHr7jnv1Kb4A_mlCnSYOAI7ItBuimXuAoEGoAHrR-1kgLgBiBsAPVbYhVXhBz17TL8L4qv6lnv7fQfr5v4J1nhJKTs9rBhpuRvL0SvhbSp9GIGGD6BBv7x0Hx-vr_EW-pyLUc4haJfsO_7lwUX0DmvkTiEBPaOYEzqfkC2pbVmonqmOdbzQfb3r2rptGWuKS9-0NVFXS0ZyvxdSyU4S05XslDxLOu8K01NFrK5oS9S0TVNK1dVCnRnbcqlYVcO20ldubGntn2vuvTAxzrrfVzXrCsuFtnEZUSIJ9LSs3GM-ZyfADsrw0fmYjIz5X3MsQp_ZNmIeI2wra2KK3_zJJKv7zStXKugYN_68Wad3c9VXoQPGi5-tQm6jRz5N9h2Tx6DPOmgndSzmYPv7BxhNusyilP4KNGShz89mCv5NywQ0LK4i0LAY-xcAAP__BLsBog">