gc: select receive with implicit conversion
Fixes #1172.
R=ken2
CC=golang-dev
https://golang.org/cl/2615041
diff --git a/src/cmd/gc/select.c b/src/cmd/gc/select.c
index 2fa4353..1a37713 100644
--- a/src/cmd/gc/select.c
+++ b/src/cmd/gc/select.c
@@ -41,11 +41,18 @@
setlineno(n);
switch(n->op) {
default:
- yyerror("select case must be receive, send or assign recv");;
+ yyerror("select case must be receive, send or assign recv");
break;
case OAS:
// convert x = <-c into OSELRECV(x, c)
+ // assignment might have introduced a
+ // conversion. throw it away.
+ // it will come back when the select code
+ // gets generated, because it always assigns
+ // through a temporary.
+ if((n->right->op == OCONVNOP || n->right->op == OCONVIFACE) && n->right->implicit)
+ n->right = n->right->left;
if(n->right->op != ORECV) {
yyerror("select assignment must have receive on right hand side");
break;