shithub: mc

Download patch

ref: fac30df5e15ad9f85ee859ae5f0cc5c9fd33088c
parent: 1c91b60dd309df7579a781e9ef3888cc6bd3484c
author: Ori Bernstein <[email protected]>
date: Sun Nov 30 17:18:01 EST 2014

Don't allow attempts to get members in types that don't support them.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1795,8 +1795,10 @@
          *               x.y : membtype
          */
     } else {
-        if (t->type == Typtr)
+        if (tybase(t)->type == Typtr)
             t = tybase(tf(st, t->sub[0]));
+        if (tybase(t)->type != Tystruct)
+            fatal(n, "type %s does not support member operators near %s", tystr(t), ctxstr(st, n));
         nl = t->sdecls;
         for (i = 0; i < t->nmemb; i++) {
             if (!strcmp(namestr(memb), declname(nl[i]))) {