<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/105957>105957</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Undefined Behavior with constexpr
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
linuxnyasha
</td>
</tr>
</table>
<pre>
```cpp
#include <memory>
constexpr auto Foo() {
const int obj = 0;
std::construct_at(&obj, 1);
return obj;
};
static_assert(Foo() == 1);
```
UB: not [transparently replaceable](https://eel.is/c++draft/basic.life#8.3). Access to old object.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxUksFurDoMhp_GbKKi4JAZWLAYyuUNuq5CYoZUmQQlobfz9kcwPZ1TCZkktj_9tn6Vkr16og5kD3Io1JaXEDtn_fbl7yotqpiCuXdw4o9PryvwAfgFUFiv3WaIgXi90S3EO4j_vpNH1MGnTF9rZGrLgY0hADaALYNz_6hg7Khh1mcWpg8GYmAcxN9sygbEBcSDFDed31U-GKcwfQC-sgqwfdazSHmLfkf9PMJ5eJ6PmLLKVr-rlCjutH90iWFX8Av6M_nj-taDuDAfMgPZ56h8WlUkn92dRVqd0qQmRyAHwGbJeU37ADgCjkSutAlw1IA9YG-imjPgOKlkdensTICiKQVgW7KL1pQSy4EFZ_Z5SOeyMJ0wrWhVQV11xloKLpEXS9ca3dSmqvSpkifdyFmcGt02gkuOqPRc2A451rzBGnklkZe1kfNJYVPzVktSBDWnm7KudO7zVoZ4LWxKG3UVl608F05N5NJhEkTtlL8C4u6X2O0NL9N2TVBzZ1NOT0S22R3Oej065MDevKHZejKsp0V92hDZ_zYv7McpxRZd93tvV5uXbSp1uAGOO_v797LGsK8FcDy07qv9lvvZ4Z8AAAD__1kB2PM">