Merge pull request #14339 from jordan-woyak/pointer-wrap-no-do-pointer

ChunkFile: Prevent PointerWrap::Do(T&) from compiling with pointers.
This commit is contained in:
Dentomologist 2026-02-10 19:20:13 -08:00 committed by GitHub
commit fe517e2287
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -264,9 +264,9 @@ public:
}
template <typename T>
requires(std::is_trivially_copyable_v<T> && !std::is_pointer_v<T>)
void Do(T& x)
{
static_assert(std::is_trivially_copyable_v<T>, "Only sane for trivially copyable types");
// Note:
// Usually we can just use x = **ptr, etc. However, this doesn't work
// for unions containing BitFields (long story, stupid language rules)