Added diagnostic about use of for example union tag as a struct tag
authorceriel <none@none>
Fri, 15 Jan 1993 12:41:15 +0000 (12:41 +0000)
committerceriel <none@none>
Fri, 15 Jan 1993 12:41:15 +0000 (12:41 +0000)
lang/cem/cemcom.ansi/struct.c

index 5c2083e..06a3094 100644 (file)
@@ -248,8 +248,15 @@ apply_struct(fund, idf, tpp)
 
        tgp = &idf->id_tag;
 
-       if (*tgp)
+       if (*tgp) {
+               if (fund != (*tgp)->tg_type->tp_fund) {
+                       error("tag %s indicates a %s, not a %s",
+                               idf->id_text,
+                               symbol2str((*tgp)->tg_type->tp_fund),
+                               symbol2str(fund));
+               }
                *tpp = (*tgp)->tg_type;
+       }
        else
                declare_struct(fund, idf, tpp);
 }