util/construct_at.h: ensure legit sizeof(Placeable)

If the memory for the designated object is allocated as char[sizeof(T)],
the size of 'Placeable' is expected to equal the size of T. However, in
principle, the compiler has the freedom to inflate the 'Placeable'
object. The static assertion gives us the assurance that the compiler
does not violate our assumption.
This commit is contained in:
Norman Feske 2025-01-06 14:22:43 +01:00 committed by Christian Helmuth
parent 1b0829e8a9
commit a06fd84b75

View File

@ -72,6 +72,8 @@ static inline T * Genode::construct_at(void *at, ARGS &&... args)
}
};
static_assert(sizeof(Placeable) == sizeof(T));
/*
* If the args input to this function contains rvalues, the compiler would
* use the according rvalue references as lvalues at the following call if