case OLSH:
case ORSH:
convlit(&n->left, t);
- n->type = n->left->type;
+ t = n->left->type;
+ if(t != T && !isint[t->etype]) {
+ yyerror("invalid operation: %#N (shift of type %T)", n, t);
+ t = T;
+ }
+ n->type = t;
return;
}
// avoided repeated calculations, errors
case OLSH:
case ORSH:
defaultlit(&n->left, t);
- n->type = n->left->type;
+ t = n->left->type;
+ if(t != T && !isint[t->etype]) {
+ yyerror("invalid operation: %#N (shift of type %T)", n, t);
+ t = T;
+ }
+ n->type = t;
return;
default:
defaultlit(&n->left, t);
yyerror("invalid operation: %#N (shift count type %T)", n, r->type);
goto error;
}
+ t = l->type;
+ if(t != T && t->etype != TIDEAL && !isint[t->etype]) {
+ yyerror("invalid operation: %#N (shift of type %T)", n, t);
+ goto error;
+ }
// no defaultlit for left
// the outer context gives the type
n->type = l->type;
BUG: should compile
=========== bugs/bug193.go
-BUG: errchk: bugs/bug193.go:13: error message does not match 'shift'
-bugs/bug193.go:13: fatal error: optoas: no entry LSH-float
-errchk: bugs/bug193.go:14: missing expected error: 'shift'
+BUG: errchk: bugs/bug193.go:14: missing expected error: 'shift'
=========== bugs/bug194.go
bugs/bug194.go:15: array index must be non-negative integer constant