Closed
Description
On recent LLVM trunk (towards LLVM 20), bisecting shows that 0a9c08c "[Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (#95474)" started to cause
$ cat test.cc
#include <cstring>
struct S { char m1, m2; };
void f(S & x) { std::memset(&x, 0, sizeof (S)); }
$ clang++ -std=c++23 -fsyntax-only test.cc
test.cc:3:17: warning: 'memset' will always overflow; destination buffer has size 1, but size argument is 2 [-Wfortify-source]
3 | void f(S & x) { std::memset(&x, 0, sizeof (S)); }
| ^
1 warning generated.