summaryrefslogtreecommitdiff
path: root/src/cmd/gc/subr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/gc/subr.c')
-rw-r--r--src/cmd/gc/subr.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c
index 9448c3ffe..b450b9b0e 100644
--- a/src/cmd/gc/subr.c
+++ b/src/cmd/gc/subr.c
@@ -548,9 +548,13 @@ maptype(Type *key, Type *val)
{
Type *t;
-
- if(key != nil && key->etype != TANY && algtype(key) == ANOEQ) {
- if(key->etype == TFORW) {
+ if(key != nil) {
+ switch(key->etype) {
+ case TARRAY:
+ case TSTRUCT:
+ yyerror("invalid map key type %T", key);
+ break;
+ case TFORW:
// map[key] used during definition of key.
// postpone check until key is fully defined.
// if there are multiple uses of map[key]
@@ -559,8 +563,8 @@ maptype(Type *key, Type *val)
// good enough.
if(key->maplineno == 0)
key->maplineno = lineno;
- } else
- yyerror("invalid map key type %T", key);
+ break;
+ }
}
t = typ(TMAP);
t->down = key;