https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81933
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The c++17/c++14 difference lies in:
4321 if (cxx_dialect >= cxx17 && !BINFO_VIRTUAL_P (binfo))
4322 {
4323 tree decl = build_base_field_1 (t, basetype, next_field);
4324 DECL_FIELD_OFFSET (decl) = BINFO_OFFSET (binfo);
4325 DECL_FIELD_BIT_OFFSET (decl) = bitsize_zero_node;
4326 SET_DECL_OFFSET_ALIGN (decl, BITS_PER_UNIT);
4327 }
if I remove the cxx_dialect check, the error is gone.