summaryrefslogtreecommitdiff
path: root/src/cmd/gc/swt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/gc/swt.c')
-rw-r--r--src/cmd/gc/swt.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cmd/gc/swt.c b/src/cmd/gc/swt.c
index 1cd4cfaa8..952c47246 100644
--- a/src/cmd/gc/swt.c
+++ b/src/cmd/gc/swt.c
@@ -313,9 +313,13 @@ casebody(Node *sw, Node *typeswvar)
// botch - shouldnt fall thru declaration
last = stat->end->n;
- if(last->op == OXFALL)
+ if(last->op == OXFALL) {
+ if(typeswvar) {
+ setlineno(last);
+ yyerror("cannot fallthrough in type switch");
+ }
last->op = OFALL;
- else
+ } else
stat = list(stat, br);
}
@@ -771,7 +775,7 @@ walkswitch(Node *sw)
sw->ntest = nodbool(1);
typecheck(&sw->ntest, Erv);
}
-
+
if(sw->ntest->op == OTYPESW) {
typeswitch(sw);
//dump("sw", sw);