<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/90130>90130</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Incorrect code generation with asan, no_unique_address, and consteval
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
davidstone
</td>
</tr>
</table>
<pre>
The following program
```c++
struct empty {
};
consteval empty make_empty() {
return empty();
}
struct one {
int m_value;
};
int value(one const x) {
return x.m_value;
}
struct wrapper {
one m_one = one{1};
[[no_unique_address]] empty m_empty = make_empty();
};
int main() {
return value(wrapper().m_one);
}
```
when compiled with `-std=c++20 -fsanitize=address` returns `4`. I would expect it to return `1`.
See it live: https://godbolt.org/z/xffYKrnTW
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0U0FvozwQ_TXDxUpk7BDgwKEpilR9x6_Sak-RYwbwrrFZ2yRpf_3KhLTptpWsxPK8efPmMSO8V51BrCDbQVYnYgq9dVUjTqrxwRpMjrZ5qZ57JK3V2p6V6cjobOfEALQG-rD8bun1SGC7eOZXH9wkA8FhDC8E8uUV8hr4cpfW-IAnoRfQIH7jYb4CK4CVd1m0dBgmZ8hd-I0nct7JWQpbgx8IlAlkOJyEnvBD5u0e49coK2LurI5cvtFxWX_F9VnF2YlxRPeBIrIPh1kfr6NOyHfpvRSg5fxJdsYeJqP-THgQTePQe8hqyOqbX4fFXF5_8u7LFt8bHYQy35t8s2ERfwWuZ8lf-34bgPsy5x4NkXYYlcaGnFXoCWzpyocGeL1MCqNk1XphVFCvCLy-dbml5CrFx5wNbOmaPJGznXRD8DKiDEQFEuyCiqA0gu7r_48YQVqdEPgD6UMYPfAHYHtg-842R6vD2roO2P4V2P7Stj__c-b5R9JUvCl5KRKs0jzd0CItM5b0FZUiz4vjVpa85Fi2HFvMS8y3WSp5mheJqhhlG7phGUszxtk642nBNsjbrJCywAI2FAeh9Frr0xBrJ8r7CauSppwmWhxR-3kZGTN4JnMQGIu76aqYszpOnYcN1coH_84SVNBYPRlpnYveSNsg6dCgE0FZczVfeGGAPZLPM8UeiTANeVvHZHK6-scvFfrpuJZ2ALaPdZe_1ejsL5QB2H5W64Ht527-BgAA__80Yk17">