================
@@ -2071,6 +2071,44 @@ static bool 
IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
       !CheckStructurallyEquivalentAttributes(Context, D1, D2))
     return false;
 
+  // In C23, if one enumeration has a fixed underlying type, the other shall
+  // have a compatible fixed underlying type (6.2.7).
+  if (Context.LangOpts.C23) {
+    if (D1->isFixed() != D2->isFixed()) {
+      if (Context.Complain) {
+        Context.Diag2(D2->getLocation(),
+                      Context.getApplicableDiagnostic(
+                          diag::err_odr_tag_type_inconsistent))
+            << Context.ToCtx.getTypeDeclType(D2)
+            << (&Context.FromCtx != &Context.ToCtx);
+        EnumDecl *Has = D1->isFixed() ? D1 : D2;
+        EnumDecl *Missing = D1->isFixed() ? D1 : D2;
----------------
Sirraide wrote:

```suggestion
        EnumDecl *Missing = D1->isFixed() ? D2 : D1;
```

https://github.com/llvm/llvm-project/pull/150946
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to