@@ -190,6 +190,12 @@ static void add_padding_msvc(struct_typet &type, const namespacet &ns)
190
190
const auto width = to_c_bit_field_type (it->type ()).get_width ();
191
191
bit_field_bits += width;
192
192
}
193
+ else if (
194
+ it->type ().id () == ID_bool &&
195
+ underlying_bits == config.ansi_c .char_width )
196
+ {
197
+ ++bit_field_bits;
198
+ }
193
199
else
194
200
{
195
201
// pad up any remaining bit field
@@ -201,6 +207,8 @@ static void add_padding_msvc(struct_typet &type, const namespacet &ns)
201
207
offset += (bit_field_bits + pad_bits) / config.ansi_c .char_width ;
202
208
underlying_bits = bit_field_bits = 0 ;
203
209
}
210
+ else
211
+ offset += underlying_bits / config.ansi_c .char_width ;
204
212
205
213
// pad up to underlying type unless the struct is packed
206
214
if (!is_packed)
@@ -231,6 +239,7 @@ static void add_padding_msvc(struct_typet &type, const namespacet &ns)
231
239
}
232
240
else if (it->type ().id () == ID_bool)
233
241
{
242
+ underlying_bits = config.ansi_c .char_width ;
234
243
++bit_field_bits;
235
244
}
236
245
else
@@ -252,6 +261,8 @@ static void add_padding_msvc(struct_typet &type, const namespacet &ns)
252
261
pad_bit_field (components, components.end (), pad);
253
262
offset += (bit_field_bits + pad) / config.ansi_c .char_width ;
254
263
}
264
+ else
265
+ offset += underlying_bits / config.ansi_c .char_width ;
255
266
256
267
// alignment of the struct
257
268
// Note that this is done even if the struct is packed.
0 commit comments