@@ -1256,48 +1256,9 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
12561256 return false ;
12571257 }
12581258
1259- if (Field1->isBitField () != Field2->isBitField ()) {
1260- if (Context.Complain ) {
1261- Context.Diag2 (
1262- Owner2->getLocation (),
1263- Context.getApplicableDiagnostic (diag::err_odr_tag_type_inconsistent))
1264- << Context.ToCtx .getTypeDeclType (Owner2);
1265- if (Field1->isBitField ()) {
1266- Context.Diag1 (Field1->getLocation (), diag::note_odr_bit_field)
1267- << Field1->getDeclName () << Field1->getType ()
1268- << Field1->getBitWidthValue (Context.FromCtx );
1269- Context.Diag2 (Field2->getLocation (), diag::note_odr_not_bit_field)
1270- << Field2->getDeclName ();
1271- } else {
1272- Context.Diag2 (Field2->getLocation (), diag::note_odr_bit_field)
1273- << Field2->getDeclName () << Field2->getType ()
1274- << Field2->getBitWidthValue (Context.ToCtx );
1275- Context.Diag1 (Field1->getLocation (), diag::note_odr_not_bit_field)
1276- << Field1->getDeclName ();
1277- }
1278- }
1279- return false ;
1280- }
1281-
1282- if (Field1->isBitField ()) {
1283- // Make sure that the bit-fields are the same length.
1284- unsigned Bits1 = Field1->getBitWidthValue (Context.FromCtx );
1285- unsigned Bits2 = Field2->getBitWidthValue (Context.ToCtx );
1286-
1287- if (Bits1 != Bits2) {
1288- if (Context.Complain ) {
1289- Context.Diag2 (Owner2->getLocation (),
1290- Context.getApplicableDiagnostic (
1291- diag::err_odr_tag_type_inconsistent))
1292- << Context.ToCtx .getTypeDeclType (Owner2);
1293- Context.Diag2 (Field2->getLocation (), diag::note_odr_bit_field)
1294- << Field2->getDeclName () << Field2->getType () << Bits2;
1295- Context.Diag1 (Field1->getLocation (), diag::note_odr_bit_field)
1296- << Field1->getDeclName () << Field1->getType () << Bits1;
1297- }
1298- return false ;
1299- }
1300- }
1259+ if (Field1->isBitField ())
1260+ return IsStructurallyEquivalent (Context, Field1->getBitWidth (),
1261+ Field2->getBitWidth ());
13011262
13021263 return true ;
13031264}
0 commit comments