fix(util/lean_obj): static assertion is not supported on Clang
g++ 4.9 can check it statically, but clang++ fails (at least on OSX).
This commit is contained in:
parent
5cac9ee01d
commit
49dbcfb1ac
1 changed files with 2 additions and 2 deletions
|
|
@ -40,12 +40,12 @@ size_t obj_header_size(lean_obj * o) {
|
|||
static_assert(sizeof(atomic<rc_type>) == sizeof(lean_obj*), "unexpected atomic<rc_type> size, the object GC assumes these two types have the same size");
|
||||
|
||||
inline lean_obj * get_next(lean_obj * o) {
|
||||
static_assert(o == static_cast<void*>(&(o->m_rc)), "the object GC relies on the fact that the first field of a structure is stored at offset 0");
|
||||
lean_assert(o == static_cast<void*>(&(o->m_rc))); // The object GC relies on the fact that the first field of a structure is stored at offset 0
|
||||
return *reinterpret_cast<lean_obj**>(o);
|
||||
}
|
||||
|
||||
inline void set_next(lean_obj * o, lean_obj * n) {
|
||||
static_assert(o == static_cast<void*>(&(o->m_rc)), "the object GC relies on the fact that the first field of a structure is stored at offset 0");
|
||||
lean_assert(o == static_cast<void*>(&(o->m_rc))); // The object GC relies on the fact that the first field of a structure is stored at offset 0
|
||||
*reinterpret_cast<lean_obj**>(o) = n;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue