diff --git a/StructFields.pm b/StructFields.pm index 2516088e9..62bfa7f21 100644 --- a/StructFields.pm +++ b/StructFields.pm @@ -671,7 +671,7 @@ sub emit_struct_fields($$;%) { } 'fields-' . $fields_group; # Needed for unions with fields with non-default ctors (e.g. bitfields) - emit "$name(){}"; + emit "$name(){memset(this, 0, sizeof($name));}"; return; }