fix(3p/tvix): properly zero the largest member of Value

The static_assert is present to force us to change the constructor when a member grows.

Change-Id: Ifa4f4a03eb7ce13cff109cf26ecf0032045905e9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1972
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
Kane York 2020-09-12 08:39:15 -07:00 committed by kanepyork
parent 2c19bd6662
commit d9c7f32a9c

View file

@ -105,7 +105,10 @@ struct Value {
NixFloat fpoint;
};
Value() : type(tInt), integer(0) {}
Value() : type(tInt), attrs(nullptr) {
static_assert(offsetof(Value, attrs) + sizeof(attrs) == sizeof(Value));
}
Value(const Value& copy);
Value(Value&& move);
~Value() {}