shithub: mc

Download patch

ref: 23f37b9d690c2c40819606a0e8be63c7206bfc1e
parent: 6ed1ebe0ee2e45b4b9079bf4ed0df24311ae4e8d
author: Ori Bernstein <[email protected]>
date: Thu Dec 18 09:57:34 EST 2014

Actually check subtypes in structs.

--- a/parse/type.c
+++ b/parse/type.c
@@ -692,14 +692,20 @@
                 return 0;
             break;
         case Tyunion:
-            for (i = 0; i < a->nmemb; i++)
+            for (i = 0; i < a->nmemb; i++) {
+                if (!nameeq(a->udecls[i]->name, b->udecls[i]->name))
+                    return 0;
                 if (!tyeq(a->udecls[i]->etype, b->udecls[i]->etype))
                     return 0;
+            }
             break;
         case Tystruct:
-            for (i = 0; i < a->nmemb; i++)
+            for (i = 0; i < a->nmemb; i++) {
                 if (strcmp(declname(a->sdecls[i]), declname(b->sdecls[i])) != 0)
                     return 0;
+                if (!tyeq(decltype(a->sdecls[i]), decltype(b->sdecls[i])))
+                    return 0;
+            }
             break;
         case Tyname:
             if (!nameeq(a->name, b->name))