mirror of
https://github.com/golang/go
synced 2024-11-21 22:04:39 -07:00
gc: fix error for floating-point constant %
R=ken2 CC=golang-dev https://golang.org/cl/5674108
This commit is contained in:
parent
03f2289f7e
commit
83feedf7bf
@ -660,6 +660,14 @@ evconst(Node *n)
|
||||
}
|
||||
mpdivfltflt(v.u.fval, rv.u.fval);
|
||||
break;
|
||||
case TUP(OMOD, CTFLT):
|
||||
// The default case above would print 'ideal % ideal',
|
||||
// which is not quite an ideal error.
|
||||
if(!n->diag) {
|
||||
yyerror("illegal constant expression: floating-point %% operation");
|
||||
n->diag = 1;
|
||||
}
|
||||
return;
|
||||
case TUP(OADD, CTCPLX):
|
||||
mpaddfltflt(&v.u.cval->real, &rv.u.cval->real);
|
||||
mpaddfltflt(&v.u.cval->imag, &rv.u.cval->imag);
|
||||
|
@ -64,6 +64,7 @@ var (
|
||||
c3 float64 = float64(Big) * Big // ERROR "overflow"
|
||||
c4 = Big * Big // ERROR "overflow"
|
||||
c5 = Big / 0 // ERROR "division by zero"
|
||||
c6 = 1000 % 1e3 // ERROR "floating-point % operation"
|
||||
)
|
||||
|
||||
func f(int)
|
||||
|
Loading…
Reference in New Issue
Block a user