go/scanner: accepts floating point literals with no decimals after E
josharian opened this issue · 2 comments
josharian commented
package main
const X = 0E
$ go tool compile x.go
x.go:3: malformed floating-point constant exponent
x.go:3: malformed constant: 0E
$ gotype x.go
$
gccgo also rejects this code. gc and gccgo are correct. From the spec's floating-point literal definition: exponent = ( "e" | "E" ) [ "+" | "-" ] decimals .
Found using go-fuzz (@dvyukov).
griesemer commented
holy cow!
gopherbot commented
CL https://golang.org/cl/32096 mentions this issue.