mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-11 21:45:37 +00:00
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:
parent
1b0829e8a9
commit
a06fd84b75
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user