summaryrefslogtreecommitdiff
path: root/src/cmd/gc/const.c
diff options
context:
space:
mode:
authorKen Thompson <ken@golang.org>2008-07-05 17:43:25 -0700
committerKen Thompson <ken@golang.org>2008-07-05 17:43:25 -0700
commit5f6655b3aa0765599347bf353cb9aba3578f7ca5 (patch)
tree9972a00900e0cda0f027a0761ba91d260677acf5 /src/cmd/gc/const.c
parent2780caca3fbc8bdb4300ccfe4120c76e086c749c (diff)
downloadgolang-5f6655b3aa0765599347bf353cb9aba3578f7ca5.tar.gz
random little bugs
SVN=126049
Diffstat (limited to 'src/cmd/gc/const.c')
-rw-r--r--src/cmd/gc/const.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/cmd/gc/const.c b/src/cmd/gc/const.c
index 9bd3e742e..12a7ef83b 100644
--- a/src/cmd/gc/const.c
+++ b/src/cmd/gc/const.c
@@ -140,12 +140,16 @@ evconst(Node *n)
}
if(wl != wr) {
- if(wl == Wlitfloat && wr == Wlitint)
- convlit(n->right, n->left->type);
- else
- if(wl == Wlitint && wr == Wlitfloat)
- convlit(n->left, n->right->type);
- else {
+ if(wl == Wlitfloat && wr == Wlitint) {
+ nr->val.dval = nr->val.vval;
+ nr->val.ctype = CTFLT;
+ wr = whatis(nr);
+ } else
+ if(wl == Wlitint && wr == Wlitfloat) {
+ nl->val.dval = nl->val.vval;
+ nl->val.ctype = CTFLT;
+ wl = whatis(nl);
+ } else {
yyerror("illegal combination of literals %d %d", nl->etype, nr->etype);
return;
}