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:
parent
2c19bd6662
commit
d9c7f32a9c
1 changed files with 4 additions and 1 deletions
5
third_party/nix/src/libexpr/value.hh
vendored
5
third_party/nix/src/libexpr/value.hh
vendored
|
@ -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() {}
|
||||
|
|
Loading…
Reference in a new issue