Skip to content

go/scanner: accepts floating point literals with no decimals after E #17621

Closed
@josharian

Description

@josharian
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 .

cc @mdempsky @griesemer

Found using go-fuzz (@dvyukov).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions