}
}
-//
-// floating point input
-// required syntax is [+-]d*[.]d*[e[+-]d*] or [+-]0xH*[e[+-]d*]
-//
func (a *Mpflt) SetString(as string) {
for len(as) > 0 && (as[0] == ' ' || as[0] == '\t') {
as = as[1:]
}
- f, ok := a.Val.SetString(as)
- if !ok {
- // At the moment we lose precise error cause;
- // the old code additionally distinguished between:
- // - malformed hex constant
- // - decimal point in hex constant
- // - constant exponent out of range
- // - decimal point and binary point in constant
- // TODO(gri) use different conversion function or check separately
- yyerror("malformed constant: %s", as)
+ f, _, err := a.Val.Parse(as, 10)
+ if err != nil {
+ yyerror("malformed constant: %s (%v)", as, err)
a.Val.SetFloat64(0)
return
}
"issue16369.go", // go/types handles this correctly - not an issue
"issue18459.go", // go/types doesn't check validity of //go:xxx directives
"issue18882.go", // go/types doesn't check validity of //go:xxx directives
+ "issue20232.go", // go/types handles larger constants than gc
)
}
--- /dev/null
+// errorcheck
+
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+const _ = 6e5518446744 // ERROR "malformed constant: 6e5518446744 \(exponent overflow\)"
+const _ = 1e-1000000000
+const _ = 1e+1000000000 // ERROR "constant too large"